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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help... Date Unrecognized...

Status
Not open for further replies.

Triplex

Programmer
Oct 10, 2002
43
PH
Dear Everyone

I have a problem with my code kindly examine it and try to find out why I'm getting an error. Thanks.

date_value = cdate(Label2.caption)

Set rsTimekeeping = New Recordset
rsTimekeeping.Open "Select * from Timekeeping where emp_id = '" & Text1.Text & "' and d_InOut = '" & Date_Value & "' and mode = '" & Mode & "' ", Application, adOpenKeyset, adLockOptimistic

----------------------------------------------------------
Error:

Run-time error '-2147217913 (80040e07)':

[Microsoft][ODBC Microsoft Access Driver]Data type mismatch
in criteria expression.

Triplex


 
check the date format in your database and then
use the format function to enter the date properly
to the database

the format function : Format(Date,"dd/mm/yyyy") for example

try Format(cdate(Label2.Caption),(the date format));
 
Enclose the date with # instead of single quotes:

d_InOut = #" & Date_Value & "# and


Or use the JET VBA functions:

d_InOut = DateValue('" & Date_Value & "')

or

d_InOut = CDate('" & Date_Value & "')
 

Problem solved...

Thanks and more power... God Bless...

Triplex
 
Triplex: Please inform us what you did to solve the problem...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top