Type Mismatch Error in Access Report

N

Nitin

Hi all

I am very new to the Access. So my problem can be silly but I am stuck
on this for last so many days.

I have a trying to print a report in access. This report is first
filtered using a form (pop up) where I have two Combo Boxes 1. Client
(Combo4) 2. Sampled Date (Combo5).

In command button of this form I have written this code

strSQL = "[" & Me("Combo4").Tag & "] = " & Chr(34) & Combo4 & Chr(34) &
" And [" & Me("Combo5").Tag & "] > " & Chr(34) & Combo5 & Chr(34)

Reports![BulkAsbestos].Filter = strSQL
Reports![BulkAsbestos].FilterOn = True

As soon as I try to display the report based on criteria entered say a
date "06/06/2006" (Which I am getting using drop down options) and a
client say "NK". And click OK, It says type mismatch Error.

I think the problem is in Sampled Date field but could not figure out
what the problem is. :(
Type of Sampled Date field is "Short Date".

Please help me out ..

Thanks
Nitin
 
D

Douglas J. Steele

Date fields need to be delimited with #, not ", and they need to be in
mm/dd/yyyy format, regardless of what your Short Date format has been set to
through Regional Settings. (Okay, this isn't strictly true. You can use any
unambiguous format such as yyyy-mm-dd or dd mmm yyyy. The point is, you
cannot use dd/mm/yyyy and expect it to work properly for the first 12 days
of each month)

strSQL = "[" & Me("Combo4").Tag & "] = " & Chr(34) & Combo4 & Chr(34) &
" And [" & Me("Combo5").Tag & "] > " & Format(Combo5, "\#mm\/dd\/yyyy\#")
 
N

Nitin

That is great!!

It is working fine.. Thanks a lot

Regards
Nitin said:
Date fields need to be delimited with #, not ", and they need to be in
mm/dd/yyyy format, regardless of what your Short Date format has been set to
through Regional Settings. (Okay, this isn't strictly true. You can use any
unambiguous format such as yyyy-mm-dd or dd mmm yyyy. The point is, you
cannot use dd/mm/yyyy and expect it to work properly for the first 12 days
of each month)

strSQL = "[" & Me("Combo4").Tag & "] = " & Chr(34) & Combo4 & Chr(34) &
" And [" & Me("Combo5").Tag & "] > " & Format(Combo5, "\#mm\/dd\/yyyy\#")


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Nitin said:
Hi all

I am very new to the Access. So my problem can be silly but I am stuck
on this for last so many days.

I have a trying to print a report in access. This report is first
filtered using a form (pop up) where I have two Combo Boxes 1. Client
(Combo4) 2. Sampled Date (Combo5).

In command button of this form I have written this code

strSQL = "[" & Me("Combo4").Tag & "] = " & Chr(34) & Combo4 & Chr(34) &
" And [" & Me("Combo5").Tag & "] > " & Chr(34) & Combo5 & Chr(34)

Reports![BulkAsbestos].Filter = strSQL
Reports![BulkAsbestos].FilterOn = True

As soon as I try to display the report based on criteria entered say a
date "06/06/2006" (Which I am getting using drop down options) and a
client say "NK". And click OK, It says type mismatch Error.

I think the problem is in Sampled Date field but could not figure out
what the problem is. :(
Type of Sampled Date field is "Short Date".

Please help me out ..

Thanks
Nitin
 

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