Type Mismatch issue when trying to Open Form using VBA (1 Viewer)

abette

Member
Local time
Yesterday, 21:56
Joined
Feb 27, 2021
Messages
85
Hi - I have an event procedure tied to the On Click property of a button on an Access Form. I need to open a 2nd form based on multiple criteria.
Normally, I would use a macro to do this but since I need to open the form based on 3 different criteria I had to use VBA.

DoCmd.OpenForm "frmProjectDetailsDisplayUnique", acNormal, "", "[UniqueItemID]=" & Me.UniqueItemID And "[ProjectID]=" & Me.ProjectID And "[DeliverableID]=" & Me.DeliverableID, , , acNormal

What is wrong with this code? The fields are all number data types. If I run the code using just one where condition it works, however, when I add the 2nd and then the 3rd I get a Type Mismatch error message when I click the button on my form.
I appreciate your help with this issue I am having.
Thank you :)
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 18:56
Joined
Oct 29, 2018
Messages
21,455
Hi. Welcome to AWF!

Try changing your criteria to this:
Code:
"[UniqueItemID]=" & Me.UniqueItemID & " And [ProjectID]=" & Me.ProjectID  & " And [DeliverableID]=" & Me.DeliverableID
 

Gasman

Enthusiastic Amateur
Local time
Today, 02:56
Joined
Sep 21, 2011
Messages
14,238
You do not use quotes for numerics ?
 

abette

Member
Local time
Yesterday, 21:56
Joined
Feb 27, 2021
Messages
85
Hi. Welcome to AWF!

Try changing your criteria to this:
Code:
"[UniqueItemID]=" & Me.UniqueItemID & " And [ProjectID]=" & Me.ProjectID  & " And [DeliverableID]=" & Me.DeliverableID
It worked! Thank you very much!
 

Users who are viewing this thread

Top Bottom