Re: Can I pass parameters from a macro to query?



"skinnybloke" <theoriginalsin73@xxxxxxxxxxx> wrote in message
news:9i501295s5p499pi8ae8on7al0sg28iq07@xxxxxxxxxx
Hi - I have 3 access queries which I run via 1 macro.

Each of the queries now requires 2 parameters when they the run. The
parameters are start and end dates.

I have built the parameters into the queries but on running the macro
I have to enter each of the dates 3 times - once for each query.

Is there an easy way to ask for the parameters once and for these to
be passed onto each query?

TIA



The standard way to do this is to have a form open with controls on it to
hold the values. For example, if you had txtStartDate and txtEndDate as
textboxes on a form, then the query could take as parameters:
Forms!MyOpenForm.txtStartDate and Forms!MyOpenForm.txtEndDate

Of course, there may be a better way to do what you are doing, but we don't
have any details. After all, you might be running action queries where it
would be more appropriate to do the whole thing in vba code with the three
actions all wrapped in a transaction.






.



Relevant Pages

  • Re: Entering data in one form while updates 2 or more tables
    ... query, which was built from two queries and one table. ... you can certainly use VBA code in the form's AfterUpdate event to open a ...
    (microsoft.public.access.forms)
  • Re: Cant update table data from form
    ... > tables (the form is built on tables, not queries). ... to more than one newsgroup, ... If the record source of the form is a table (not a multi-table query) ...
    (microsoft.public.access.forms)
  • RE: Dynamically referencing a recordset?
    ... through that recordset to set the query parameters in VBA. ... to be the one who had to modify 1440 queries if there is a change in the ... different table schema, then you need 3, one for each record type. ... This is a database that tracks the production on records in another ...
    (microsoft.public.access.modulesdaovba)
  • Re: Was: what does "serialization" mean?
    ... > the specific queries up front. ... that the NEXT time the query is run the query is fast, ... data base, don't know squat" when in fact the Donald clone doesn't ... >> WHATEVER would probably be a separate query to summarize total sales. ...
    (comp.programming)
  • Re: Official Status of SQLServer 2005 ADP
    ... I have said that the support for SQL passthrough ... queries under MDB was bad and worst than the one offered by ADP while you ... > attempt to "pass through" every Access query against a linked ODBC ...
    (microsoft.public.access.adp.sqlserver)