Results 1 to 2 of 2
  1. #1
    Raygar is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    2

    Button linking back to form?

    Hi.
    I'm new here.
    I have a scenario that I need help with.

    Report has a button on each entry.

    When you click on the button, I want to load up the form to that entry and set focus.

    I sorta had it but didn’t work exactly the way I wanted.
    What happened is that I deleted some records. Now the values appearing in the ID field (primary key) range is at 28-127. 100 actual records, but record 1 has the ID 28. See below for my button code.
    If I click on the button, it’ll go the 28th record, not the first record. I tried many times to use google but wasn't able to jerry rig the examples I saw correctly (I'm not that good in Access). Anyway, I pasted all the relevant objects that I think are important.

    Private Sub Command3_Click()
    DoCmd.GoToRecord acDataForm, "Call Log", acGoTo, ID
    Forms![Call Log].SetFocus
    End Sub

    Object names for the Report
    Report Name: “Report1”



    Bound object: “ID” (primary key)

    Object names for the Form
    Form Name: “Call Log”

    Bound object: “ID” (primary key)

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    If you don't care about being able to navigate to other records then try opening the form using WHERE CONDITION argument which will filter the form to the one record.

    DoCmd.OpenForm "Call Log", , , "ID=" & Me!ID
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Bring back focus to a form
    By AbbHeDa in forum Programming
    Replies: 6
    Last Post: 04-28-2012, 01:50 AM
  2. BACK BUTTON Not Working
    By HENRYM in forum Forms
    Replies: 5
    Last Post: 01-19-2012, 03:16 PM
  3. Linking button on form to report
    By robertdudley95 in forum Forms
    Replies: 19
    Last Post: 11-09-2011, 12:14 PM
  4. Linking Combobox back to table
    By jlclark4 in forum Forms
    Replies: 52
    Last Post: 12-31-2010, 03:18 PM
  5. Back to original form
    By hawzmolly in forum Forms
    Replies: 4
    Last Post: 09-26-2010, 07:36 AM

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