AllExperts > Using MS Access 
Search      
Using MS Access
Volunteer
Answers to thousands of questions
 Home · More Using MS Access Questions · Answer Library  · Encyclopedia ·
More Using MS Access Answers
Question Library

Ask a question about Using MS Access
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Richard Rost
Expertise
I am happy to answer any kinds of questions about Microsoft Access - from basic table design to advanced VBA programming. Also, please feel free to check the Access Tips & Tricks section of my web site.

Experience
I am the president of AccessLearningZone.com and 599CD.com. I specialize in Microsoft Access Tutorials. I have been teaching Access in the classroom since 1994, and online since 2002.

Education/Credentials
I am a self-taught Access expert. I have been building databases for clients since the early 90s. You can see a sample of my Access Tutorials on my web site at 599CD.com

 
   

You are here:  Experts > Computing/Technology > Business Software > Using MS Access > Using VBA to call queries inside forms

Using MS Access - Using VBA to call queries inside forms


Expert: Richard Rost - 1/2/2008

Question
Hi Richard,

Thank you very much again for your help with my last VBA issue.  Now I have a more general question.

In my last question you explained how to reference a particular field in VBA to run an Update query using SQL.  Now I have have a question regarding using VBA to pull up forms.  I understand the basic DoCmd function, but if I have a form that is dependant on a query which requires certain values to be input, how can I tell access to use a certain field for these required values.  

For example, if I have a form that requires me to enter the effective date and plan number (because of the underlying query) how can I tell it to look for these values in a field on a separate form?

Thank you!

Answer
Just use Forms!FormName!FieldName notation for the criteria in your query.

Let's say you have a form named CustomerSelectF with a combo box called CustomerCombo (based on CustomerID field). In your query, you would simply have this as the criteria for your CustomerID field:

=Forms!CustomerSelectF!CustomerCombo

Easy enough? I cover this in my Access 202 tutorial: http://599cd.com?GOAC202


Let me know if you have any more questions or comments.

Cordially,

Richard Rost
President/CEO
599CD Computer Training
http://www.599cd.com/Microsoft_Access_Tutorial


P.S. Come and try one of my ACCESS TUTORIAL VIDEO LESSONS on my web site FREE. Just use this link. http://www.599cd.com?AEXAC

P.P.S. Remember, I volunteer my time at AllExperts to help people, so I can't take 20 minutes to answer each question. If you need more DETAILED HELP, come to my TechHelp web site at http://www.599cd.com/TechHelp and I'll take as much time as you need to answer your question.  

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.