Datamismatch when doing a VBA Event in Access

cres1121
cres1121 used Ask the Experts™
on
I want to pass a variable when I double click on a form to open another form.  

 Line item number is a auto number with long integer on one table.

On the second table it is number with long integer.

When I created the double click event when I am on line item number

Private Sub line_item_number_DblClick(Cancel As Integer)
DoCmd.OpenForm "TBLservicelinedetails", WhereCondition:=" [line item number] = '" & Me.[line item number] & "'"
End Sub

Run time error 3464
Data type Mismatch in criteria expression....
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:
the field "line item number" could be Number data type, so use this

DoCmd.OpenForm "TBLservicelinedetails", WhereCondition:=" [line item number] = " & Me.[line item number]

Author

Commented:
Perfect.  How do I make it a popupform?    So when I double click it will just be a little popup?
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
Append the dialogue parameter:

DoCmd.OpenForm "TBLservicelinedetails", acNormal, , "[line item number] = " & Me![line item number].Value & "", acFormEdit, acDialog

Open in new window

/gustav
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Top Expert 2016
Commented:
set the popup property of the form  "TBLservicelinedetails" to YES
you can also set the Modal property of the form to YES if needed

Author

Commented:
Wonderful.. I knew the pop up was easy just could not remember and he got my event to work.

Author

Commented:
Thank you!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial