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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what could be wrong?...

Status
Not open for further replies.

jonra

Programmer
Jul 20, 2003
42
SG
i wan to open a report from my form...when i click the button to open the report...it gave me a error "Data type mismatch in criteria expression"...whats wrong?...can someone help?...

my code

Private Sub Command12_Click()
On Error GoTo Err_Command12_Click


DoCmd.OpenReport "incident", acViewPreview, , "[ID]='" & Forms![ret]!txtID & "'"

Exit_Command12_Click:
Exit Sub

Err_Command12_Click:
MsgBox Err.Description
Resume Exit_Command12_Click

End Sub
 
Is the txtID field on the same form as the command button? If so, try Me!txtID instead of Forms![ret]!txtID.

Ken S.
 
After looking at your code again, it looks like your syntax is correct. I would double-check that the [ID] field is of the same data type as the [txtID] field.
 
thanks eupher..i recreat the form n the form works fine...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top