Link to home
Start Free TrialLog in
Avatar of Fordraiders
FordraidersFlag for United States of America

asked on

I keep getting type mismatch

access 365


I keep getting  type mismatch  on this statement ?

racfid = 'bbbbb'
f.fields(1)  =  "2/5/2020 10:52:53 AM"   ' date format
Date is ahowing as  "02/05/2020"

  ' set the access temp local table just in case i need it.
Set r = CurrentDb.OpenRecordset("Select [racfid], [Logged_In], [Logged_Out] from qry_CurrentUser where [racfid] = '" & racfid & "'", dbOpenDynaset, dbSeeChanges)


If Len(Nz(r.Fields(1), "")) > 0 Then
         If (r.Fields(0) = racfid) And (DateValue(r.Fields(1)) = Date) Then
           MsgBox "You are Logging out of the Tracker, vbCritical", "Log Out Issue"    <--------- error here ?
           r.Edit
           r![Logged_Out] = Now()
           r.Update
           r.Close
           Set r = Nothing
Avatar of Arana (G.P.)
Arana (G.P.)

what is the type of racfid, seems like it would be numeric, integer, not string/text
racfid = 'bbbbb'

also check your date fields are atual date type andd not text type,  If they are Text fields, you will probably get that error trying to set a text field to a date value.  Also make sure that there are no records that do not have a valid date in the date fields
Maybe this is a part of a Function and you have declared the racfid as Numeric and you are feeding alphanumeric
Avatar of Fordraiders

ASKER

racfid is a alpha numeric string- text
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks scott