stLinkCriteria Date & Text

Oscar_W

Registered User.
Local time
Today, 05:26
Joined
Mar 9, 2006
Messages
42
I have spent most of the day on this and despite searching through the Forum I have not found an answer :(

stLinkCriteria1 and stLinkCriteria2 work on their own, but when I try to join them to use both the date and text I get a type mismatch....

Code:
stDocName = "Operations_By_Unit"
testdate = Date
testdate = Format(testdate, "MM/DD/YYYY") ' Converts date format to US for Findfirst

stLinkCriteria1 = "[StartDate] = #" & testdate & "# "
stLinkCriteria2 = "[Unit] = " & Chr(34) & Me!CboUnit & Chr(34)

stLinkCriteria3 = ("[StartDate] = #" & testdate & "# ") And ("[Unit] = " & Chr(34) & Me!CboUnit & Chr(34))

Me.Undo
DoCmd.Close acForm, "PreOpen"
DoCmd.OpenForm stDocName, , , stLinkCriteria3

Oscar
 
Try this:

stLinkCriteria3 = "[StartDate] = #" & testdate & "# And [Unit] = " & Chr(34) & Me!CboUnit & Chr(34)

Frank
 
Frank,

That's the beasty ! It's easy when you know how.

Thanks.
 

Users who are viewing this thread

Back
Top Bottom