Help with Type Mismatch

P

Paul B.

I'll admit it, I will probably never get this right, I've tried, but I must
ask for help again...

stLinkCriteria = ("[FRName] = '" & Me.FRName & "'" AND "[DateOfService] >= &_
Me.StartDate & ")

I seem to recall that I needed to use the # symbol for dates, so I tried and
just made it worse, so if someone could help me out here, I would as always
appreciate it.

Cheers
 
D

Dirk Goldgar

Paul B. said:
I'll admit it, I will probably never get this right, I've tried, but
I must ask for help again...

stLinkCriteria = ("[FRName] = '" & Me.FRName & "'" AND
"[DateOfService] >= &_ Me.StartDate & ")

I seem to recall that I needed to use the # symbol for dates, so I
tried and just made it worse, so if someone could help me out here, I
would as always appreciate it.

Try this:

stLinkCriteria = _
"FRName = " & Chr(34) & Me.FRName & Chr(34) & _
" AND DateOfService >= " & _
Format(Me.StartDate, "\#mm/dd/yyyy\#")

I took the liberty of replacing the single-quotes you were using to
delimit Me.FRName with double-quotes -- Chr(34) -- just in case FRName
might ever contain a single-quote character or apostrophe.
 
M

Marshall Barton

Paul said:
I'll admit it, I will probably never get this right, I've tried, but I must
ask for help again...

stLinkCriteria = ("[FRName] = '" & Me.FRName & "'" AND "[DateOfService] >= &_
Me.StartDate & ")

I seem to recall that I needed to use the # symbol for dates, so I tried and
just made it worse, so if someone could help me out here, I would as always
appreciate it.


You were right about using a # sign around date/time values,
but the serious error is that the AND must be inside the
quotes:

stLinkCriteria = "[FRName] = '" & Me.FRName & " _
"' AND [DateOfService] >= #" & Me.StartDate & "#"

If you may be using your app on systems with other that USA
data formats, then the second line needs to be:

"' AND [DateOfService] >= #" & Format(Me.StartDate,
"m\d\yyyy") & "#"
 
P

Paul B.

Many thanks to both. Your continuous assistance to everyone here is greatly
appreciated.

Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top