Combo Box selection going to Rpt

  • Thread starter Thread starter Tony Schlak
  • Start date Start date
T

Tony Schlak

I have a form the has three combo box's on it. I those box's allow me to
select three different choices. From there I would like to code in the three
selections and have them used as the filter for my query. Here is what i
have so far.

Private Sub DoPrintOut(nMethod As Integer)
On Error GoTo Err_DoPrintOut

If IsNull(Me.Admin_Name) Then
MsgBox "Please select a Admin Name before trying to print."
Else
DoCmd.OpenReport strReport, nMethod, , "( [AdminID = " &
Me.Admin_Name & "] [Professor = " & Me.Prof_Name & "] [DocType = " &
Me.Doc_Type & "]) "
Me.SetFocus
DoCmd.Close
End If

Exit_DoPrintOut:
Exit Sub

Err_DoPrintOut:
MsgBox Err.Description
Resume Exit_DoPrintOut

End Sub

When i run it with just the Admin_Name and send it to a query it works. When
I add in the other two selections it gives me an error saying :

Syntax error (missing operator) in query Expression '(( Admin = 103
Proffesor = 100025 DocType=102))'.

Thanks,
Tony
 
Thanks

Klatuu said:
(( Admin = 103 And Proffesor = 100025 And DocType=102))

Tony Schlak said:
I have a form the has three combo box's on it. I those box's allow me to
select three different choices. From there I would like to code in the
three
selections and have them used as the filter for my query. Here is what i
have so far.

Private Sub DoPrintOut(nMethod As Integer)
On Error GoTo Err_DoPrintOut

If IsNull(Me.Admin_Name) Then
MsgBox "Please select a Admin Name before trying to print."
Else
DoCmd.OpenReport strReport, nMethod, , "( [AdminID = " &
Me.Admin_Name & "] [Professor = " & Me.Prof_Name & "] [DocType = " &
Me.Doc_Type & "]) "
Me.SetFocus
DoCmd.Close
End If

Exit_DoPrintOut:
Exit Sub

Err_DoPrintOut:
MsgBox Err.Description
Resume Exit_DoPrintOut

End Sub

When i run it with just the Admin_Name and send it to a query it works.
When
I add in the other two selections it gives me an error saying :

Syntax error (missing operator) in query Expression '(( Admin = 103
Proffesor = 100025 DocType=102))'.

Thanks,
Tony
 
Back
Top