Type Mismatch

Results 1 to 3 of 3

Thread: Type Mismatch

  1. #1
    Join Date
    Dec 1969

    Default Type Mismatch

    I&#039m trying to add records to an Access database. I&#039m using ADO. I&#039m trying to add fields that are date and number fields and I get an error "Type Mismatch" when I submit the new record.<BR>What&#039s the solution?

  2. #2
    prabhat Guest

    Default RE: Type Mismatch

    you should not use single quotes around number fields and with date fields u should use # on both the sides of the value

  3. #3
    John P Guest

    Default RE: Type Mismatch

    here is a section from my ASP. it demonstrates the date and time routines I use with Access. If you are saving text I presume I don&#039t need to explain everything..<BR><BR>this is a direct update .. it can also be achieved via SQL..<BR><BR>while we in aussie use dd/mm/yy i found that SQL dates must use #mm/dd/yy# regardless of the regional settings.<BR><BR>here goes..<BR><BR> IF (Cmd = "SAVE") THEN<BR> set cmdTemp = Server.CreateObject("ADODB.Command")<BR> Set RSU = Server.CreateObject("ADODB.Recordset")<BR> cmdTemp.CommandText = "SELECT * FROM Events WHERE Id = " & EID<BR> cmdTemp.CommandType = 1 &#039 Allows updates to the recordset...<BR> Set cmdTemp.ActiveConnection = Conn<BR> RSU.Open cmdTemp, , 1, 3 &#039 Options for opening the recordset<BR><BR> IF NOT RSU.EOF THEN<BR> RSU.MoveFirst<BR> IF IsDate(Request("FromDate")) THEN<BR> RSU("FromDate").Value = CDate(Request("FromDate"))<BR> ELSE<BR> RSU("FromDate").Value = Null<BR> END IF<BR><BR>&#039This lot will allow military 24 hour time entry (eg 1345)<BR>&#039 or normal 24 hour entry (eg 13:45)<BR>&#039The default is null<BR> sInputTime = Request("Time")<BR> &#039response.write( sInputTime)<BR> sInputTime = Replace( sInputTime, ":", "")<BR> IF Not( (IsNull (sInputTime)) OR ( sInputTime = "") OR (Not IsNumeric( sInputTime))) THEN<BR> Do While ( Len( sInputTime) &#060; 4)<BR> sInputTime = sInputTime + "0"<BR> Loop<BR> iHours = CInt( Left( sInputTime, 2))<BR> iMinutes = CInt( Right( sInputTime, 2))<BR> dTime = TimeSerial( iHours, IMinutes, 0)<BR> RSU("Time").Value = dTime<BR> ELSE<BR> RSU("Time").Value = Null<BR> END IF<BR><BR><BR> RSU("UpDateBy").Value = UID<BR> RSU("UpDated").Value = Date & " " & Time<BR> RSU.Update<BR> ELSE<BR> BadUpdate = True<BR> END IF<BR> RSU.Close<BR> Set RSU = nothing<BR> END IF &#039 of (Cmd = "SAVE")<BR><BR><BR>good luck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts