query parameter

J

Joel Allen

Hello,

I have a query that has a parameter that you need to enter. I can call the
query from the command line with this line of code. Can I somehow make it
call a parameter too. Here's an example:

This calls the query. I want it to enter the parameter too.

"C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE"
"\\tgps8\documents\Company Documents-Public\PM Department\Link Ron's
Database to PMTool\Ship Date sync.mdb" /x mcrConfirmedShipDate


Thanks for your help,
Joel
 
K

Klatuu

Add the /cmd switch as the last parameter in the command line with the value
enclosed in quotes.

Then use the Command function in VBA to retrieve the value.
See Help for Command Function for more detail. Also seach for Command Line
Switches in Help.
 
J

Joel Allen

It didn't seem to work. The query just opened waiting for me to enter the
parameter. Is this syntax right?

"C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE"
"\\tgps8\documents\Company Documents-Public\PM Department\Link Ron's
Database to PMTool\Ship Date sync.mdb" /x mcrFixTask /cmd"223668"
 
K

Klatuu

You have to have a form with a control on it to put the value of the command
funtion in and use that control as the reference in the query.

So in the query it would be something like:

[Forms]![StartForm]![txtParam]

Then in the Load event of the form:

Me.txtParam = Command
Of course, you will want to close the form when the query completes.
 
J

Joel Allen

Can I start over? I really appreciate your help, but let me just explain
exactly what I'm doing. I don't think I explained it right from the start.

I have a query that has one parameter. When I open it, it asks me for the
job #. I enter 123456 for example, and all is good.

Now, I'm trying to call this query from another program, which I can do, but
I want to pass on the parameter of 123456 into that query without typing it.
I thought it could be done in the same string, for example:

"C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE"
"\\tgps8\documents\Company Documents-Public\PM Department\Link Ron's
Database to PMTool\Ship Date sync.mdb" /x qryFixTask /cmd"123456"

What do you think?

Thanks, Joel



Klatuu said:
You have to have a form with a control on it to put the value of the
command
funtion in and use that control as the reference in the query.

So in the query it would be something like:

[Forms]![StartForm]![txtParam]

Then in the Load event of the form:

Me.txtParam = Command
Of course, you will want to close the form when the query completes.
--
Dave Hargis, Microsoft Access MVP


Joel Allen said:
It didn't seem to work. The query just opened waiting for me to enter
the
parameter. Is this syntax right?

"C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE"
"\\tgps8\documents\Company Documents-Public\PM Department\Link Ron's
Database to PMTool\Ship Date sync.mdb" /x mcrFixTask /cmd"223668"
 
K

Klatuu

You have to leave one blank space before each switch and one before each
parameter. You don't have a space after /cmd
Should be:
"C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE"
"\\tgps8\documents\Company Documents-Public\PM Department\Link Ron's
Database to PMTool\Ship Date sync.mdb" /x qryFixTask /cmd "123456"

--
Dave Hargis, Microsoft Access MVP


Joel Allen said:
Can I start over? I really appreciate your help, but let me just explain
exactly what I'm doing. I don't think I explained it right from the start.

I have a query that has one parameter. When I open it, it asks me for the
job #. I enter 123456 for example, and all is good.

Now, I'm trying to call this query from another program, which I can do, but
I want to pass on the parameter of 123456 into that query without typing it.
I thought it could be done in the same string, for example:

"C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE"
"\\tgps8\documents\Company Documents-Public\PM Department\Link Ron's
Database to PMTool\Ship Date sync.mdb" /x qryFixTask /cmd"123456"

What do you think?

Thanks, Joel



Klatuu said:
You have to have a form with a control on it to put the value of the
command
funtion in and use that control as the reference in the query.

So in the query it would be something like:

[Forms]![StartForm]![txtParam]

Then in the Load event of the form:

Me.txtParam = Command
Then run the query here.

Of course, you will want to close the form when the query completes.
--
Dave Hargis, Microsoft Access MVP


Joel Allen said:
It didn't seem to work. The query just opened waiting for me to enter
the
parameter. Is this syntax right?

"C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE"
"\\tgps8\documents\Company Documents-Public\PM Department\Link Ron's
Database to PMTool\Ship Date sync.mdb" /x mcrFixTask /cmd"223668"

Add the /cmd switch as the last parameter in the command line with the
value
enclosed in quotes.

Then use the Command function in VBA to retrieve the value.
See Help for Command Function for more detail. Also seach for Command
Line
Switches in Help.
--
Dave Hargis, Microsoft Access MVP


:

Hello,

I have a query that has a parameter that you need to enter. I can
call
the
query from the command line with this line of code. Can I somehow
make
it
call a parameter too. Here's an example:

This calls the query. I want it to enter the parameter too.

"C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE"
"\\tgps8\documents\Company Documents-Public\PM Department\Link Ron's
Database to PMTool\Ship Date sync.mdb" /x mcrConfirmedShipDate


Thanks for your help,
Joel
 
J

Joel Allen

That didn't work. The "Enter Parameter Value" dialog box pops up and is
waiting for me to enter a value. Any other ideas?

Klatuu said:
You have to leave one blank space before each switch and one before each
parameter. You don't have a space after /cmd
Should be:
"C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE"
"\\tgps8\documents\Company Documents-Public\PM Department\Link Ron's
Database to PMTool\Ship Date sync.mdb" /x qryFixTask /cmd "123456"

--
Dave Hargis, Microsoft Access MVP


Joel Allen said:
Can I start over? I really appreciate your help, but let me just explain
exactly what I'm doing. I don't think I explained it right from the
start.

I have a query that has one parameter. When I open it, it asks me for
the
job #. I enter 123456 for example, and all is good.

Now, I'm trying to call this query from another program, which I can do,
but
I want to pass on the parameter of 123456 into that query without typing
it.
I thought it could be done in the same string, for example:

"C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE"
"\\tgps8\documents\Company Documents-Public\PM Department\Link Ron's
Database to PMTool\Ship Date sync.mdb" /x qryFixTask /cmd"123456"

What do you think?

Thanks, Joel



Klatuu said:
You have to have a form with a control on it to put the value of the
command
funtion in and use that control as the reference in the query.

So in the query it would be something like:

[Forms]![StartForm]![txtParam]

Then in the Load event of the form:

Me.txtParam = Command
Then run the query here.

Of course, you will want to close the form when the query completes.
--
Dave Hargis, Microsoft Access MVP


:

It didn't seem to work. The query just opened waiting for me to enter
the
parameter. Is this syntax right?

"C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE"
"\\tgps8\documents\Company Documents-Public\PM Department\Link Ron's
Database to PMTool\Ship Date sync.mdb" /x mcrFixTask /cmd"223668"

Add the /cmd switch as the last parameter in the command line with
the
value
enclosed in quotes.

Then use the Command function in VBA to retrieve the value.
See Help for Command Function for more detail. Also seach for
Command
Line
Switches in Help.
--
Dave Hargis, Microsoft Access MVP


:

Hello,

I have a query that has a parameter that you need to enter. I can
call
the
query from the command line with this line of code. Can I somehow
make
it
call a parameter too. Here's an example:

This calls the query. I want it to enter the parameter too.

"C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE"
"\\tgps8\documents\Company Documents-Public\PM Department\Link
Ron's
Database to PMTool\Ship Date sync.mdb" /x mcrConfirmedShipDate


Thanks for your help,
Joel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top