Declare variable for 5 Queries

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a macro (non Code) which calls 5 different queries - all of which use
the same parameter.

Now bearing in mind other people use this macro and therefore it cannot be
converted to VB how can I declare the variable once and not 5 times??
 
Mark,

Make a simple form called, say, MyForm, with a textbox called, say,
MyParameter. Then modify your five queries so that the criterion reads:

[Forms]![MyForm]![MyParameter]

This way the queries read their parameter directly from the form (so it
has to be entered only once). Having got this far, add a command button
on the form to run the macro, and it's about as good as it gets!

By the way, in my view the more the target users, the more control
required > the more reasons I have to use VB code! In what way is the
number of users preventing the use of VB code?

HTH,
Nikos
 
Use a form to launch the 5 queries and add and unbound text
box to store the parameter. In you queries use for the
criteria
[Forms]![NameOfForm]![NameOfTextbox]

Chris
 
We have a number of part trained access users - all up to query standard so
everything is run by query (not form based and definitely not VB based). The
queries are to format our Month end data so it has to be in a form which
everyone can use easily and without confusion.

I was hoping to declare a variable on macro line 1 and then reference it
within each of the queries - any other ideas?

PS thanks for your quick response
 
-----Original Message-----
I have a macro (non Code) which calls 5 different queries - all of which use
the same parameter.

Now bearing in mind other people use this macro and therefore it cannot be
converted to VB how can I declare the variable once and not 5 times??
--
Cheers

Mark
.
 
No. That's the standard way, and that's so users don't need to go into
design, because users *shouldn't* change the design! That's what user
interfaces are for.
Now, if some users are adventurous, they are welcome to play around with
their own propotypes all they want; the moment they hack a productive
company tool they should be shot, except they won't because I'll shoot
myself first for letting a back door open for them to do so.
Furthermore, if a user feels up to changing a query but can't work with
forms, that's the particular user I wouldn't allow within 100m of my
design; partial knowledge (to put it politely) is far more dangerous
than ignorance.

Nikos
 
Mark,

I agree 100% with Nikos here. Forms are the heart of Access. If you
want something that "everyone can use easily and without confusion", I
can't imagine anything easier than an unbound textbox on a form where
the users enter the criteria required, the query criteria references
this textbox in the way Nikos suggested, and the macro to run the
queries is assigned on the Click event of a command button on the same
form. If there is a problem with this approach, let us know.
 
Back
Top