Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Making a subform popup/disappear with a button

Posted on 2009-02-20
14
Medium Priority
?
993 Views
Last Modified: 2013-11-28
Which property and methods do I want to address with VBA in order to make a subform popup at the bequest of a button command and to make it it disappear after the database advances to the next record?
0
Comment
Question by:9XqUwH3S
  • 6
  • 4
  • 3
  • +1
14 Comments
 
LVL 13

Accepted Solution

by:
wiswalld earned 900 total points
ID: 23694652
Forms!mainform.subform.form.visible = false  'or true
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 300 total points
ID: 23694760
subform popup ??? are you referring to a subform inside a form or an independent form?

Forms!NameOfForm.setfocus
docmd.close
0
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 300 total points
ID: 23694767
In addition to wiswalld's comment, you would use code in the Current Event of your main form to make this happen as the user goes from record to record.

The Current Event fires when the form first opens, and whenever the user moves to a noe record.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:9XqUwH3S
ID: 23694876
Alas, I include too little information.
I want a simple subform or form to popup when I press a button. However, I want to make sure that the combo box on the subform enters the selection into the field on the main form.
[I'm so grateful for your patience.]
I've  included  my 2 forms and my relationships. Feel free to draw on them.
I'm saving these projects to study. I learn best by reverse-study, so I am duly grateful for your extra instruction.
Earnestly,
Steve
Akron, OH

Main-Form.jpg
PopUp-Form.JPG
Relationships.JPG
0
 

Author Comment

by:9XqUwH3S
ID: 23694892
Do I need to work on my tables before I procede? And do the suggestions you gave, above, still apply, here?
0
 
LVL 13

Assisted Solution

by:wiswalld
wiswalld earned 900 total points
ID: 23695117
So create the pop up form and open like this

DoCmd.openform "formname", acNormal, , "[autonumber]=  " & Me.Autonumber
0
 

Author Comment

by:9XqUwH3S
ID: 23695568
Let me backup a step or two: Can a subform or a form that is connected to a main form exist separate (not embedded) from the main form?
0
 
LVL 13

Assisted Solution

by:wiswalld
wiswalld earned 900 total points
ID: 23696750
Yes

You can have a pop up form and open like I stated above. The form will open to the related record.
0
 

Author Closing Comment

by:9XqUwH3S
ID: 31549362
Thank you.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 23705071
I lost track of this one...

<Can a subform or a form that is connected to a main form exist separate (not embedded) from the main form?>

If the "connection" you are referring to is the Master/Child link that synchronizes an embedded subform with it's parent, then the answer is "no". These links exist only between a main form, and an embedded "Subform Control". Subforms are simply another type of control placed on your form with their own set of properties that include these data links.

The workaround when using a seperate popup form is to write code to control the popup form's current record from the main form. wiswalld showed you how to open a popup form to a specific record. You can also write code to change the popup form's record to match the record in the main form.

That said, I personally find that for that level of control (completely synchronizing a main form with a popup), an embedded subform is a better option. If space is an issue there is always the option of using a tab control and embedding the subform on a seperate tab on the same form.
0
 

Author Comment

by:9XqUwH3S
ID: 23705112
You are thorough.
I suspected that was the case but now, I have that confidence.
You are appreciated.
I am growing in my knowledge of all of this.
Say, do you know off-hand a good  'canned code' website? When you come across one, can you append to this thread?
Thanks for the enthusiasm. What propelled you toward mastery? What 'kept you at-it', so to speak?
Where you a hobbiest prior to being professional?
0
 
LVL 61

Expert Comment

by:mbizup
ID: 23710963
This is a good reference and tutorial for SQL Syntax (just bear in mind that this is not specifically Access SQL, and some of the examples will not work in an Access environment):
http://www.1keydata.com/sql/sql.html

General Access and VBA tutorials with plenty of sample code:
http://www.functionx.com/vbaccess/index.htm
http://www.blueclaw-db.com/accessvisualbasic/

If you are a hands-on learner, Microsoft has some good templates for A2K7:
http://office.microsoft.com/en-us/templates/CT101426161033.aspx

Also, some of our Experts have posted samples that answer many FAQ's:
http://www.databasedevelopment.co.uk/examples.htm  (LPurvis)
http://www.thenelson.name/    (thenelson)

Another great resource for samples:
http://www.lebans.com/
0
 
LVL 61

Expert Comment

by:mbizup
ID: 23711127
<What propelled you toward mastery? .... Where you a hobbiest prior to being professional?>

Mastery might be overdoing it :-). I'm the office IT "gofer" because I enjoy solving problems.

My formal training was in Electrical Engineering with a focus on Digital Design. I got into Software Engineering just because that was where all the jobs were at the time (late '80's) - there was a real need for programmers and few to go around. So I'm mostly self-taught.

<What 'kept you at-it', so to speak?>
I found that I liked programming a lot better than the hardware stuff I went to school for.

In terms of EE, I love written communication and technical writing.

I've also learned a lot from reading and asking questions here myself, so paritcipating as an Expert is simply giving back. I've been able to share a lot of the concepts that I've learned here myself.

A very enjoyable aspect of participating in an online technical community is passing on your interpretation of what you've learned and seeing that get passed along to others in other threads.

I described that to someone recently as being like modern-day, high-tech storytelling. That is *very* cool and is a major driving factor that keeps me contributing.
0
 

Author Comment

by:9XqUwH3S
ID: 23711346
Hmmh. It's discouraging to hear how so many college/university graduates find themselves doing crazy things.
We all try to find our path and/or survive as best we can.
I'm wondering if I'm learning in the right way or if I'm going to be smart enough (I should be but am getting a little concerned).
Do you remember your first day of high school and you didn't know where you were and you might have forgotten your locker combination and you couldn't find study hall! That's how I feel about VBA code, alone  --  even tho I have some excellent materials.
I thing the Adult ADHD I take medication for is still getting the best of me. I can't afford to live and go to school with my disability so this is terning out to be an affordable education.
I had a skilled trade that I can no longer practice, for health reasons. I'm without skills and didn't fair well in the trade for which I wasn't suited well for. Therefore, I'm embarking on what I expect to be a short-term cleaning business. I can certainly use automation from the Office System.
Anyway, I'm sure I'll paths will cross on this site. Nice talking with you.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question