Results 1 to 4 of 4
  1. #1
    gtiller is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    6

    Question Update Query against current record not entire table

    Hi all,

    I have a really simple query, which populates four fields in one of my tables:

    UPDATE [Personnel Records]
    SET
    [Personnel Records].[Full Name] = [First Name] & " " & [Last Name],
    [Personnel Records].Initials = Left([First Name],1) & Left([Last Name],1),


    [Personnel Records].[E-mail Address] = [First Name] & "." & [Last Name] & "@DEMO",
    [Personnel Records].Username = "DEMO\" & [Last Name] & Left([First Name],1);

    The query is initiated when I hit the save record button (a macro)
    How do I update just the current record instead of the entire table?

    I don't want to calculate these values within the table itself (although I am aware that you can do this with Access 2010), as eventually all of my tables will be moved to SQL, and the forms and queries will be packaged.

    Thanks!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You need to add a WHERE clause that specifies the PrimaryKey of the Current record.

  3. #3
    gtiller is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    6
    Aha, great.

    Never used where before.

    Is the syntax something like this:

    WHERE [Personnel Records].[recordID] = forms![myformname]![recordID]

    Cheers

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Let the Query wizard help you with the syntax. I'm a long way from an expery on SQL.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Current Record Update Issue
    By SALPBE in forum Programming
    Replies: 0
    Last Post: 02-23-2011, 03:02 PM
  2. Update single record via forum, not entire table?
    By 10 Gauge in forum Programming
    Replies: 2
    Last Post: 02-11-2011, 09:14 AM
  3. Run Update Query on Current Record in Form
    By c3pse in forum Queries
    Replies: 3
    Last Post: 08-14-2010, 05:40 AM
  4. Query based on current record in form
    By bhsvendbo in forum Queries
    Replies: 1
    Last Post: 06-01-2010, 11:20 AM
  5. How to output only current record in query
    By mslieder in forum Access
    Replies: 0
    Last Post: 01-20-2006, 05:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums