Help opening up query into form

M

mwest

I have a query called retreived selected contaminant,department,date and the
code below however when I enter the information below it gives me a blank
form instead of the information I requested.

Private Sub MultiOK_Click()
On Error GoTo b
If IsNull(Me.Combo0) Or IsNull(Me.Combo2) Then
MsgBox "Please include all criteria for the report.", vbInformation, "Some
nifty title here."
Me.Combo0.SetFocus
GoTo a
End If
Me.Visible = False
DoCmd.OpenForm "contaminant,department,date Display"
DoCmd.Close acForm, Me.Name
DoCmd.SelectObject acForm, "contaminant,department,date Display"
a: Exit Sub
b: MsgBox Err.Number & " " & Err.Description
Resume a
End Sub
 
S

strive4peace

Instead of putting the criteria in your query, try using the
WHERECLAUSE parameter of the Openform action

DoCmd.OpenForm formname[, view][, filtername][,
wherecondition][, datamode][, windowmode][, openargs]

for help on OpenForm, press the F1 key on the word
"OpenForm" in your code or in the Immediate window

you also should replace the commas with underscores in your
formname. It is a good idea to only use letters, numbers
(but never as the first character), and underscores in
tablenames, fieldnames, fornmames, etc -- and avoid using spaces

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 

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

Similar Threads

Help with query 6
Date Warning MsgBox 2
Alter Code for Batch Printing 8
PopUp Date Picker Form 4
Emailing Question from my DB 2
Blank Date Option 0
Append query doesn't work 5
Cancel timer event if criteria not met 1

Top