Type Mismatch issue when trying to Open Form using VBA

abette

Member
Local time
Today, 14:29
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 :)
 
Hi. Welcome to AWF!

Try changing your criteria to this:
Code:
"[UniqueItemID]=" & Me.UniqueItemID & " And [ProjectID]=" & Me.ProjectID  & " And [DeliverableID]=" & Me.DeliverableID
 
You do not use quotes for numerics ?
 
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

Back
Top Bottom