Run-Time Error

  • Thread starter Thread starter ServiceEnvoy
  • Start date Start date
S

ServiceEnvoy

I'm getting a run-time error '13' with this line of code:

Private Sub VendorID_DblClick(Cancel As Integer)
DoCmd.OpenForm FRM_Expenses2, acFormDS, , , "vendorid=" & Me.VendorID
End Sub

I'm trying to open a form in Datasheet view called "Frm_Expenses2" and
display the records which have a matching vendorID field.

What do I need to do to resolve this error?
 
Best guess would be that VendorID is text (which it should be as you won't do
math with it) but your code it set up as if VendorID were numeric. I suspect
that

DoCmd.OpenForm FRM_Expenses2, acFormDS, , , "vendorid=" & Me.VendorID

should be

DoCmd.OpenForm FRM_Expenses2, acFormDS, , , "vendorid='" & Me.VendorID & "'"


I think I got those single/double quotes right! Can't check right now. Post
back if it still doesn't run!
 
Back
Top