Results 1 to 6 of 6
  1. #1
    GHudson
    Guest

    Update one field record in table from form

    I need the current date to be updated into the "ImportedDate" field and there will only be one record in this table. The table name is "tValues" and the two fields in the table are "ImportedDate" and "ExportedDate". Someting is not right for I am getting the message "appending 0 rows". What am I doing wrong? Thanks!

    DoCmd.RunSQL "update tValues set ImportedDate = #" & Date & "#"

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Update one field record in table from form

    Hi,
    I'm afraid I can't actually see anything wrong with that code. You certainly shouldn't be getting any messages about appending data (you would get something like "You are about to update 0 rows" if the table were empty at the time.) Do you have any other code involved?
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    GHudson
    Guest

    Re: Update one field record in table from form

    No other code is involved. Some how I need to update the field "ImportedDate" in table "tValues" with the current date. I am at a loss for the code looks ok but it is not updating the current record and even if the field i empty, I need it to update the "ImportedDate" with the current date. The code is not erroring, it just is not updating the current date into the field. Thanks in advance for your help!

    DoCmd.RunSQL "update tValues set ImportedDate = #" & Date & "#"

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Update one field record in table from form

    Hi,
    Two quick questions - are there any other fields in the tValues table and is there definitely at least one record in that table?
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    GHudson
    Guest

    Re: Update one field record in table from form

    There are only two (ImportedDate & ExportedDate) fields in the "tValues" table. There is only one record and both fields have todays date. I am changing my system date for testing. Thanks!

  6. #6
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    352
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Update one field record in table from form

    Try

    DoCmd.RunSQL "update tValues set tValues.[ImportedDate] = #" & Date & "#"
    David Grugeon
    Brisbane Australia

Posting Permissions

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