Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2002

    Unhappy Unanswered: Update statement

    I'm trying to update two fields in a table using SQL code. Following is the code I am using:

    sqlupdate = "UPDATE tbltravelerscontact SET contactlogdate = '" & txtDate & "' and contactlogreason = '" & txtReason & "'"

    sqlupdate = sqlupdate & " WHERE TravelerID = " & Forms!frmtravelerinfo!lstTraveler.Value & " and ContactID = " & Forms!frmtravelerinfo!lstContact.Value

    db.Execute (sqlupdate)

    For some reason, this code is not working. I have used an Update statement similar to this and it worked fine. It is not giving any errors, it is just after I run this and look in the table, the values are not updated. Any ideas why this isn't working? Any help would be greatly appreciated! BTW, this is Access 2000.


  2. #2
    Join Date
    Jul 2002
    Replace your AND with a comma (,) between your Set statements.

    UPDATE [table] SET [Field1] = value1, [field2] = value2, WHERE condition

    There have been many posts made throughout the world.
    This was one of them.

Posting Permissions

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