Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Type Mismatch ? using form with date 1

Status
Not open for further replies.

Dylan

MIS
Aug 27, 1998
109
US
I have a ? concerning a query that keeps giving me a "data type mismatch" when the qry runs. the criteria looks for 2 date flds being equal. One fld is from a table (data type = date) and the other fld is on a form as a text box with a format of short date. Can you help me with this ???

Thanks tom

Tom Moran
Lansing, Michigan
 
Tom

You may consider encapusulating the date field with the Access date delimiter, "#"

If MyDateField = "#" & MyTextField & "#" Then
....

Richard
 
...better yet.

If MyDateField = "#" & CDate(MyTextField) & "#" Then

The CDate() function verfies the enclosed variable is a date.
 
Hi Willir,

I tried it but got mismatch error again ...

Heres the qry

SELECT Count(tbl_spet.tbl_batch_date) AS RecCnt, tbl_spet.tbl_batch_date INTO tbl_count
FROM tbl_spet
GROUP BY tbl_spet.tbl_batch_date
HAVING (((tbl_spet.tbl_batch_date)=("#" & CDate([Forms]![frm_main_menu]![frm_lockdate]) & "#")));


Tom Moran
Lansing, Michigan
 
[tt]
SELECT Count(tbl_spet.tbl_batch_date) AS RecCnt, tbl_spet.tbl_batch_date INTO tbl_count
FROM tbl_spet
GROUP BY tbl_spet.tbl_batch_date
HAVING (((tbl_spet.tbl_batch_date)=CDate([Forms]![frm_main_menu]![frm_lockdate])));
[/tt]
 
THANKS MUCH ... works like a charm !!!!!!!!!




Tom Moran
Lansing, Michigan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top