Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Sep 2010
    Location
    Cheltenham, Gloucestershire, UK
    Posts
    12
    Thanks
    4
    Thanked 0 Times in 0 Posts

    run update only on current record in continuous form

    I have a field [hyperlink] which contains a hyperlink to a folder relevant to the unique id ref field [jobs_ID].

    I have an update query which will populate the hyperlink field with the explorer path (which is the same for all) but picks up the folder numebr from the id ref field. The only trouble is when I run it it tries to update all 4000 records in the table - when I only need the current one. Please what can I do to make the query only run on the current row/record? Thanks Roberta

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    To restrict it to a single record, the query needs a Where clause (what you see as the Criteria in Design View)

    This would update all records
    Code:
    "Update tblsomething set tblsomething.fieldname ='new value' "
    but this would only update the one record where Jobs_ID=12
    Code:
    "Update tblsomething set tblsomething.fieldname ="new value" Where tblsomething.[jobs_D]=12"
    In your case you don't want a hardcoded value for jobs_ID, you want the value from the current record of the form.

    Code:
    "Update tblsomething set tblsomething.fieldname ="new value" Where tblsomething.[jobs_D]=" & forms("formname").[jobs_ID]
    Regards
    John



  3. The Following User Says Thank You to johnhutchison For This Useful Post:

    robertaw (2011-04-14)

Posting Permissions

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