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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help in Access MACRO's

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0

I have a form called "GUI" which requests the "From" and "To" date parameters based on which a Macro is initiated by the OnClick event.
The Macro basically deletes an entire table and then populates it with fresh data from different tables. The Macro is made up of many SQL statements, here is an example of one of the SQL statements..."insert into Student select * from Student_Wva"
How can I pass the "From" and "To" dates entered by the user in the form "GUI" to these SQL statements in the Macro?

Thanks for in advance!
 
Have the Macro use OpenQuery actions for the SQL statements, and put the statements in Query objects.

Then in the Query objects could have something like

insert into Student
select * from Student_wva
where StudentDate >= Forms!GUI!FromDateControl
and StudentDate <= Forms!GUI!ToDateControl
Ben
+61 403 395 052
 
Are you using RunSQL actions in your macros? I'm not sure, but I think you can put the Forms!GUI... code right into the macro parameter. That would save you from having to create separate queries and convert your macros to use OpenQuery. Rick Sprague
 

Yeah, I am using RunSQL actions in my macro's. Do you think I can add the &quot;where Date between 'Forms!GUI!From' and ''Forms!GUI!To'&quot; statement to my code?

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top