Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jul 2005
    Location
    North Carolina, USA
    Posts
    195
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Using UPDATE to change a blank field (2003)

    Hi!, How can I make the update statement to change a field that may have whatever value in it or be blank with the new value.. this is the code that i've being working and it keeps giving me a parameter prompt. Any help is appreciated!

    DoCmd.RunSQL "UPDATE qryCourseCAuto SET ChangeBy = " & CurrentUser() & " WHERE ChangedBy"

    Also I tried the code like this as well

    DoCmd.RunSQL "UPDATE qryCourseCAuto SET ChangeBy = " & CurrentUser() & " "

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Using UPDATE to change a blank field (2003)

    If you want to update ALL records, you can omit the WHERE clause. But you must enclose the value of CurrentUser in quotes:

    DoCmd.RunSQL "UPDATE qryCourseCAuto SET ChangeBy = " & Chr(34) & CurrentUser() & Chr(34)

    Chr(34) is the double quote character ".

  3. #3
    2 Star Lounger
    Join Date
    Jul 2005
    Location
    North Carolina, USA
    Posts
    195
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: Using UPDATE to change a blank field (2003)

    You're the best, once again! That fix the problem. Just learned something new.

Posting Permissions

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