Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Location
    Pgh
    Posts
    8

    Lightbulb Unanswered: Updating a current record

    Using the below subprocedure:

    Private Sub Vul_Needed_Click()
    DoCmd.RunSQL "UPDATE [tblView] set [Total_Devices]=0, [Patched_Devices]=0"
    End Sub

    How do I change just [Total_Devices] and [Patched_Devices] on the current record.

    I need to have the UPDATE on the current record and not the entire table. Any help would be greatly apprecaited.

    - Puthoff

  2. #2
    Join Date
    May 2002
    Location
    Atlanta, GA
    Posts
    117
    Hey,

    You just need to add a WHERE clause to the end of your statement. If I was using a table of names with first and last names it would look something like this:

    UPDATE Names SET First = "John", Last = "Smith" WHERE First = "John";

    Depending on what type of field you are wanting to filter by you may have to alter the statement.

    Kal

  3. #3
    Join Date
    May 2003
    Location
    Pgh
    Posts
    8
    Yeah that would work but the problem is that I will not know what the value of the (as in your case) "First". The field will be a number that changes frequently. I need to find some other way to update just the current record that I am working on.

    Originally posted by kpalmer
    Hey,

    You just need to add a WHERE clause to the end of your statement. If I was using a table of names with first and last names it would look something like this:

    UPDATE Names SET First = "John", Last = "Smith" WHERE First = "John";

    Depending on what type of field you are wanting to filter by you may have to alter the statement.

    Kal

Posting Permissions

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