Results 1 to 2 of 2
  1. #1
    xwnoob is offline Advanced Beginner
    Windows Vista Access 2000
    Join Date
    Nov 2011
    Posts
    76

    Use 2 listboxes to select field from main form and subform to open form in edit mode

    Hi,

    I currently have a select form where users select a record based on BorrowerTitle, FacilityName,CommitmentID using a single listbox and then clicking a button to open the selected record in edit mode.

    This has caused a problem as BorrowerTitle and TitleAgreement can have many facilityNames so what i want to do is first user will select BorrowerTitle and CommitmentID in the first listbox(My borrowertitle and CommitmentID have a relationship so its counted as a single record) and subsquently the facilities related to borrowertitle/CommitmentID will appear on the second listbox so that i can select them and edit them. Currently I am using a button to open records and this is my code:


    Code:
    DoCmd.OpenForm "AddCommitmentDetail", , , "CommitmentID=" & Me.ListShowCommit.Column(0)
    I think i only need help in linking the two listboxes together as i know how to open the selected record using the code i mentioned above.

    BorrowerTitle belongs to tblBorrower,CommitmentID belongs to tblCommit,FacilityName belongs to tblFacility

    CommitmentID has one-to-many relationship with tblfacility

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    I'm not sure I understand. Maybe it is this:

    User makes selection from first list box

    second list box gets requeried based on selection (Me!secondlistbox.Requery) - in the SQL for the second list box set the selection criteria equal to Forms!xxx!firstlistbox for the fields that you need.

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

Similar Threads

  1. Replies: 5
    Last Post: 11-11-2011, 11:06 AM
  2. Replies: 2
    Last Post: 09-01-2011, 10:48 PM
  3. Replies: 2
    Last Post: 08-11-2011, 10:02 AM
  4. Replies: 4
    Last Post: 01-14-2011, 10:37 AM
  5. Replies: 4
    Last Post: 05-17-2010, 05:32 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