Filter continuous subform with two criteria

EternalMyrtle

I'm still alive
Local time
Today, 03:45
Joined
May 10, 2013
Messages
533
Hello I am trying to use this code to filter a continuous subform based on two criteria but getting a data type mismatch error.

It works fine if I filter by just one or another. Perhaps it is not possible:confused:

Or, does someone know a way?

Code:
Dim intSpouseEntityID As Integer

intSpouseEntityID = Nz(DLookup("[EntityID]", "qryEntitiesLocations", "[ContactIDNumber] =" & Me.Spouse), 0)

If intSpouseEntityID > 0 And Not IsNull(Me.subformContactsHomeAddress.Form.EntityID) Then
MsgBox ("There are two spouse addresses please delete one and try again")
DoCmd.Save
DoCmd.OpenForm "frmContactAddresses", , , "EntityID=" & Me.txtEntityID Or "EntityID =" & intSpouseEntityID
End If
 
I want the continuous form to show both EntityIDs, so two records...
 
I solved this problem by:

1. creating a calculated field in my form for the Dlookup to the spouse's EntityID
2. Creating a filter query and using that instead of a WHERE statement
 

Users who are viewing this thread

Back
Top Bottom