Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    8

    Unhappy Unanswered: Can not delete record

    Hello everybody,

    I have a syntax error in this code:

    With adoRS

    db.Execute "DELETE from MyTable WHERE format(ID," & Chr(34) & "mm/dd/yyyy HH:MMS" & Chr(34) & ")=" & varD

    .MoveNext
    If .EOF Then .MoveLast
    End With

    varD is DateTime type variable.

    I've tried without formatting, still have an error. Can anybody help me out? Thanks.

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    First step is making sure the defined recordset is good... Have you tried putting this in a select query yet?

    SELECT * from MyTable WHERE format(ID," & Chr(34) & "mm/dd/yyyy HH:MMS" & Chr(34) & ")=" & varD

  3. #3
    Join Date
    Mar 2004
    Posts
    8
    Originally posted by Teddy
    First step is making sure the defined recordset is good... Have you tried putting this in a select query yet?

    SELECT * from MyTable WHERE format(ID," & Chr(34) & "mm/dd/yyyy HH:MMS" & Chr(34) & ")=" & varD
    I' ve tryed this in Access:

    Select * from MyTable where ID=#1/15/2004 13:15:5#;

    and it works fine. When I substitute:

    varD = .Fields("ID") ' varD is DateTime type
    db.Execute "Select * from MyTable WHERE ID=#" & varD & "#"

    It gives me an error: Missing operand.

Posting Permissions

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