Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    67

    Unanswered: Setting all Table field records = constant

    Is there an easy way to set all records for a Table's Field equal to a constant. I need to set all records for one Field = 0 and all records for a 2nd Field = 1. All I can think of doing is creating a Query and then converting the Query back to a Table. This sounds pretty inefficient. Is there an easier way? I need to do this with VBA.

    Thanks for any help.

    Jim

  2. #2
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    UPDATE TABLE SET FIELD1 = 0, FIELD2 = 1

    That's pretty much the SQL statement you'll need.

    If you have to do this with VBA, you can use
    CurrentProject.Connection.Execute "UPDATE TABLE SET FIELD1 = 0, FIELD2 = 1;"
    All code ADO/ADOX unless otherwise specified.
    Mike.

  3. #3
    Join Date
    Feb 2004
    Posts
    67
    Originally posted by HomerBoo
    UPDATE TABLE SET FIELD1 = 0, FIELD2 = 1

    That's pretty much the SQL statement you'll need.

    If you have to do this with VBA, you can use
    CurrentProject.Connection.Execute "UPDATE TABLE SET FIELD1 = 0, FIELD2 = 1;"

    HomerBoo,

    Thanks much. That sure is a lot easier than the path I was following.

    Jim

Posting Permissions

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