Results 1 to 6 of 6
  1. #1
    ledis is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2014
    Posts
    7

    Bring up records linked to specific field on a form using a comand button

    hi, i will have to explain this with screen shots. So lets say i have a Customer form which has an ID, NAME & PHONE field. I want to use a button on that field to open another form called Bikes which will be linked to the ID field of the customer so he can have more than one bike to his record. like a sub form but opened in a new form.
    I have the relations set up as one to many, i hope the Ss help
    1.Click image for larger version. 

Name:	relations.jpg 
Views:	6 
Size:	24.9 KB 
ID:	153572.Click image for larger version. 

Name:	customer.jpg 
Views:	6 
Size:	37.5 KB 
ID:	153583. Click image for larger version. 

Name:	bikes.jpg 
Views:	6 
Size:	28.8 KB 
ID:	15359

  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
    A form/subform arrangement is the simplest approach. Opening a related form independently and populating the foreign key customer_ID field can be accomplished several ways.

    One is to set the DefaultValue property of the customer_ID field on the Bikes form to: Forms!Customer!ID. Then manually move to new record row or use code to move or even have the form open directly to new record row.
    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
    ledis is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2014
    Posts
    7
    Quote Originally Posted by June7 View Post
    A form/subform arrangement is the simplest approach. Opening a related form independently and populating the foreign key customer_ID field can be accomplished several ways.

    One is to set the DefaultValue property of the customer_ID field on the Bikes form to: Forms!Customer!ID. Then manually move to new record row or use code to move or even have the form open directly to new record row.
    Thank you for your fast reply, but being the novice that i am i don't understand what to do. Not even sure where to start to be honest.

  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
    Then why don't you use the form/subform approach?
    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
    ledis is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2014
    Posts
    7
    Quote Originally Posted by June7 View Post
    Then why don't you use the form/subform approach?
    Yes, i think im going to use the Tab feature. I just thought it would look better with the command buttons. Cause i wanted to have one that goes straight to a new record and that goes to the 1rst on and you navigate through the rest.

  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
    The more 'user friendly' the more code.

    If you want to go straight to new record, will need code (macro or VBA) or set the form to DataEntry property to Yes.
    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. Replies: 2
    Last Post: 02-08-2014, 07:10 PM
  2. Replies: 2
    Last Post: 11-01-2013, 09:57 AM
  3. Replies: 5
    Last Post: 04-23-2013, 03:22 PM
  4. Replies: 2
    Last Post: 06-09-2011, 09:47 AM
  5. Replies: 11
    Last Post: 06-02-2011, 10:21 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