Results 1 to 10 of 10
  1. #1
    Vadran is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2015
    Posts
    6

    Go to selected record

    Hey guys, new to the forum and fairly new to access as well (no formal training whatsoever).

    So I'm making a database and need help.



    So far I have a Table that has data, and I run it through a query to filter, and end user will see a form with add/edit buttons. To add data I have user fill out a popup form with drop down boxes and that works fine, but I want the same thing for an edit tab. When I use the button the edit form, it always defaults to the first item in the list, rather than the one that's selected on the previous form.

    How would I mouse select table data, open the edit form, and have it open the selected line item?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    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.

  3. #3
    Vadran is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2015
    Posts
    6
    Data is already filtered. I was able to do a query for that.


    Let's say I selected item ID 42.


    Click image for larger version. 

Name:	Selected.jpg 
Views:	7 
Size:	90.0 KB 
ID:	21696

    But when I hit edit, it opens the first line item on this query list. Right now its a simple "open form" command but I don't know how to have it go to the item that's selected.


    Click image for larger version. 

Name:	Edit.jpg 
Views:	7 
Size:	107.2 KB 
ID:	21697

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Are you showing tables/queries or forms on each of those tabs?

    Post your code for analysis.
    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.

  5. #5
    Vadran is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2015
    Posts
    6
    Each tab will be a different table query.


    So far all I was able to figure out is how to do an embedded macro for the "Edit" button. My VBA skills are practically non existent but figured this is a good excuse to learn.



    Click image for larger version. 

Name:	code.png 
Views:	7 
Size:	5.2 KB 
ID:	21698

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    What you show is a macro, not VBA.

    Need criteria in the WHERE CONDITION argument. I've never tried this with a table/query as the SourceObject for a subform container. Not sure can be done. Try:

    [Record ID]=[subform container name here]![Record ID]


    Should avoid spaces and special characters/punctuation (underscore is exception) in naming convention.
    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.

  7. #7
    Vadran is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2015
    Posts
    6
    hmm. no dice. Would it be possible with VBA?

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    What happened?

    I just did a test with macro and table as SourceObject. It does work. Just have to get the criteria expression correct.

    [Record ID]=Forms!formname!subformcontainername![Record 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.

  9. #9
    Vadran is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2015
    Posts
    6
    Ok. So I dragged and dropped the query its self onto the tab and it didn't seem to care for that. I created a subform and that made it work. Still have to type it though so I need to play with it and see if I can figure it out.

  10. #10
    Vadran is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2015
    Posts
    6
    wait figured it out. Awesome. Thanks for your help good sir!

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

Similar Threads

  1. ListBox Selected Record
    By bahalzamon in forum Access
    Replies: 4
    Last Post: 08-04-2015, 03:12 PM
  2. Replies: 2
    Last Post: 03-03-2015, 07:20 AM
  3. Replies: 3
    Last Post: 02-06-2015, 01:18 PM
  4. Add selected record to report
    By bassplayer79 in forum Reports
    Replies: 1
    Last Post: 10-07-2013, 01:41 PM
  5. Go to selected record
    By Newbie11 in forum Forms
    Replies: 4
    Last Post: 01-07-2012, 04:29 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