Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parameter query

Status
Not open for further replies.

flycold

Programmer
Jan 17, 2004
15
GB
hi

i have a parameter query that runs fine the first time i run it. When i press a command button it asks for date, which then bring up another with the results. when i press the button again it brings the same results and does not ask me for the date.

what i need it to do is ask for a date everytime i press the command button. at present i have to shut down access and re-start for the parameter box to be shown again.

i would also want to run the query from the form produced for that query. i.e the user reviews the data when the query is run the first time and then wnats to run the query again with a different value.

thanks

flycold

 
Can you paste the code here that is attached to the click event of the command button?
 
I have created a form using a wizard and having the query as a source. I have created a small macro for the command button, when pressed run query which in turn displays the results in the form.

the code behind the button on the front page is:-

Private Sub Command5_Click()

End Sub


the code behind the button on the form is :-


Private Sub Command37_Click()
On Error GoTo Err_Command37_Click

Dim stDocName As String

stDocName = "greater than 2000"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Command37_Click:
Exit Sub

Err_Command37_Click:
MsgBox Err.Description
Resume Exit_Command37_Click

End Sub

thanks

Flycold
 
I have a macro that I run that conatins 3 reports. It also has a parameter which the user will enter the date range they want for the report. The problem is I have to enter that date 3 time. How can I pass the date entered ro all of the reports within this macro?
 
prompt the user using a pop up form. In other words, create your own popup form and promp the user from there. You can then use that field in all your queries.
 
Question for flycold. Does your users close the query after viewing it? I just tried it and if I close the query, it prompts me again the next time. If I leave the query open, it just pops up that one.
 

i closed the form before asking for the date to be entered again, the key is to call the output form and not the original query. if you call th eoriginal query the results are displayed in datasheet format.

thanks

flycold

 
hmmm, you might want to use my suggestion from 03/12/2004, above. I was able to get it to work though for me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top