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



That is exactly what I had suggested. Neverthless, you may still benefit
from seeing how others would do the whole routine in vba.


"skinnybloke" <theoriginalsin73@xxxxxxxxxxx> wrote in message
news:vc7012hke3g5i99b44ja2gfpj25rek3cup@xxxxxxxxxx

Then again I may be able to do it like this


http://groups.google.co.uk/group/microsoft.public.access.modulesdaovba/browse_thread/thread/b58ab771f40c4da6/76d979a1a68945e9?lnk=st&q=ms+access+pass+parameter+from+macro+to+queries&rnum=46&hl=en#76d979a1a68945e9



On Thu, 09 Mar 2006 12:11:08 GMT, skinnybloke
<theoriginalsin73@xxxxxxxxxxx> wrote:

Hi - my knowledge of Access and VBA is very sketchy so please bear
with me.

The way that I have set this up is via a switchboard. You click on an
option and it runs code to delete 3 files if they already exist and
then runs 3 queries to export 3 excel files.

This was fine until the parameters were required as an additional
requirement.


On Thu, 9 Mar 2006 12:02:38 +0000 (UTC), "Anthony England"
<aengland@xxxxxxxxxx> wrote:

"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: Data Changing Issue
    ... In the query, on the field line, I added the above expression. ... *if* you are in VBA. ... the data of your table from a recordset. ... I am running some queries using a form I created and for some ...
    (microsoft.public.access.queries)
  • Re: Data Changing Issue
    ... "Michel Walsh" wrote: ... In the query, on the field line, I added the above expression. ... *if* you are in VBA. ... I am running some queries using a form I created and for some ...
    (microsoft.public.access.queries)
  • Re: Inserting data from 2 tables into 1
    ... been busy with Access and VBA for about 6 ... I would make all the queries and then use a set of macros to ... > Do you perhaps mean look for duplicates in tbResultsTemp? ... > The first is easier and lets you use all the nice interfaces like query ...
    (microsoft.public.access.modulesdaovba)
  • Re: Data Changing Issue
    ... *if* you are in VBA. ... think you were using either VBA code, either a query.) ... is very unlikely to print some value of myid present in table1... ... I am running some queries using a form I created and for some strange ...
    (microsoft.public.access.queries)
  • Re: Can I pass parameters from a macro to query?
    ... then runs 3 queries to export 3 excel files. ... Each of the queries now requires 2 parameters when they the run. ... I have to enter each of the dates 3 times - once for each query. ... you might be running action queries where it ...
    (comp.databases.ms-access)