Computing.Net > Forums > Programming > access 2000/20002 macros

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

access 2000/20002 macros

Reply to Message Icon

Name: AC
Date: July 5, 2002 at 17:48:51 Pacific
Comment:

hi,

i'm trying to create parameters within my macro, but i've not been able to find the syntax to do so ... in an Osborne publication i read that you should use the 'runsql' action but that's all it said

of all the valid keywords that could be used in the sql statement for a runsql, 'PROCEDURE' seemed to be the only viable option. but i just can't nail the syntax.

or am i completely of base ...

help please!!!

thanks



Sponsored Link
Ads by Google

Response Number 1
Name: A Certain TH
Date: July 6, 2002 at 16:33:25 Pacific
Reply:

Hi AC

Maybe I'm missing the point, but I think your question is unanswerable as it stands.

What specifically are you trying to achieve? Create parameters... for what? Use SQL... on what? ... to retrieve what?

Maybe someone else can guess what you mean, but otherwise I'd say post back some more info, and you may get more help!

Cheers
Tom


0

Response Number 2
Name: AC
Date: July 7, 2002 at 16:00:39 Pacific
Reply:

o.k. Tom i'll try again,

i'm using access 2002, and i'm trying to buid a macro that will run several queries that i've created. i know how to do that.

what i need to know is how the user can enter the date span (those are the parameters) into the macro.

i read in a manual that to use parameters with macros, you should use the runsql action. but that's all i know. so my question is, the runsql action and what?

is that any clearer?

thanks


0

Response Number 3
Name: A Certain TH
Date: July 8, 2002 at 00:57:31 Pacific
Reply:

Ah! I see. Hmm, the best method is going to depend on exactly what you want to do. How many queries the date affects, for example.

If the date only affects one query, then you can do this:

Write a short function which asks the user for a date. Something like:

Function DateGetter() As Date
Dim myDate As Variant
Do Until IsDate(myDate) = True
myDate = InputBox("What date would
you like?", "Date", "dd/mm/yy")
Loop
DateGetter = myDate
End Function

(The reason for the loop is because if you cancel the input, then the type of variable is not 'Date' which could give you problems downstream)

Then, in the criteria for your query, right-click and use "Build" - Functions, Databasename, Module name, "DateGetter". Then every time the query runs, it will ask for a date. So, you can use the same function to return a start and end date. (Or duplicate the function, so the box actually specifies which its asking for)

HOWEVER - if your subsequent queries need to know that date too, then I would SQL it. I'm not 100% sure its the best method, but I don't know a better one (and it saves being asked the dates seven times!). Getting this right is easier than it sounds, but it can be a bit of a faff, because the strings can get a bit unwieldy.

Let me know if you need to learn how to do that, and I'll get in touch.

Good luck
Tom


0

Response Number 4
Name: AC
Date: July 8, 2002 at 06:52:57 Pacific
Reply:

thanks.

yes, that's what i need (the SQL) ... i have three queries running on the same dates ... so i'm currently getting prompted for the date for each query.

:-)


0

Response Number 5
Name: A Certain TH
Date: July 8, 2002 at 07:57:04 Pacific
Reply:

Hang on - I'll email you directly.

Tom


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: access 2000/20002 macros

VB in Access 2000 www.computing.net/answers/programming/vb-in-access-2000/6005.html

Access 2000 Date/Time help www.computing.net/answers/programming/access-2000-datetime-help/2783.html

Access 2000 www.computing.net/answers/programming/access-2000/1029.html