Parameter query for year

G

Guest

I am using access 97, I am almost completed this project but am wondering how
I can get the query to open directly into a form. So far my query button
looks like this

Private Sub Command33_Click()
On Error GoTo Err_Command33_Click

Dim stDocName As String

stDocName = "Retreive Selected Year"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Command33_Click:
Exit Sub

Err_Command33_Click:
MsgBox Err.Description
Resume Exit_Command33_Click

End Sub

Am I way off in what I am trying to do, when I type in the date I get the
information I want however it is not in a form. Thanks so much in advance.
 
F

fredg

I am using access 97, I am almost completed this project but am wondering how
I can get the query to open directly into a form. So far my query button
looks like this

Private Sub Command33_Click()
On Error GoTo Err_Command33_Click

Dim stDocName As String

stDocName = "Retreive Selected Year"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Command33_Click:
Exit Sub

Err_Command33_Click:
MsgBox Err.Description
Resume Exit_Command33_Click

End Sub

Am I way off in what I am trying to do, when I type in the date I get the
information I want however it is not in a form. Thanks so much in advance.

Make the query "Retreive Selected Year" the Record source of a form.
Then simply open the form, not the query:

DoCmd.OpenForm "FormName"

By the way, "Retreive" is spelled incorrectly above. While Access
doesn't care (as long as it's always spelled the same, someone else in
the future, modifying your database and spelling retrieve correctly,
will have some problems with errors when Access cannot fine the query.
It should be "Retrieve".
 

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