Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Query from Form

Status
Not open for further replies.

Zahir

Programmer
Sep 16, 1999
28
PK
I want to call my Query from the Form with a Button Control.<br>
<br>
How can i do this ..<br>
<br>
<br>
if any one knows.. give me responce and obliged.<br>
<br>
Thanks<br>

 
Assuming that your form has an underlying query that you want to re-execute; use “requery” to re-execute the query and refresh the form. Create a macro with the requery action (and execute it from the button’s click event). Or, in vb code use “DoCmd.Requery”<br>
<br>
You can always change a form’s underlying query in code by modifying the RecordSource property i.e. Form_Form1.RecordSource = &quot;query name&quot; and then using requery.<br>

 
If you're not familiar with Access's button wizard, it's a good way to start. Just make sure the wizard icon is selected when you use the toolbar to add the button to the form. Choose Category: Miscellaneous, and Action:Run Query, and follow the rest of the prompts. If you want to call the underlying query, just substitute bitbrain's code for lines 3 thru 5. This way you get error handling added &quot;for free&quot;.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top