Results 1 to 2 of 2
  1. #1
    Smtz is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2013
    Posts
    2

    Forms and Subforms

    I have a question about forms and subforms. Here are the forms and tables I have in my database that pertain to my question:

    Tables:
    tblCases
    tblPeople
    tblPeoplePerCase

    Forms:
    frmCases
    frmPeople
    frmSearchPeople


    subfrmPeoplePerCase


    I need to be able to relate a person(s) to a case that displays on the Cases form. The Cases form currently has a subform that lets me manually add people to the case and the info then populates the People per Case table. The information being stored in the People Per Case table is the Case ID, Person ID, and Person Type (they select this once the person is added to the subform). The subform has a dropdown list of everyone in the People table, but only shows some of their information (Person ID, Employee Number (not everyone has an Employee Number), Last Name, First Name, and Middle Name). If a new person has to be added, the user can click the edit button on the list (which sometimes disappears once the person starts scrolling through the list), and the People form is opened and the information is then added and linked to the case manually. This has been working ok, however the list of people is growing so I thought it would be better to do something a little more sophisticated. What I'm thinking of is adding a button to the Cases form that would open the Search People form. The user would then search and select a particular person or create a new person. This would take them to the People form so the user can either verify the person's information or add/update information. The People form would have a button to relate the person to the current case on the Cases form. Once clicked, it would ask the user if they want to add the selected person (would like the message box to show their name) to the current case (Case ID on the Cases form). If they select no, then the action would be canceled. If they select yes, then a new record with the Person ID from would be added to the People Per Case subform.

    I'd like to do this in Visual Basic, but am not sure how to approach this.

    Any help would be appreciated!
    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    You said Visual Basic - do you mean the Visual Basic programming app or did you mean VBA behind Access?

    Passing data from one form to another can be tricky. Options:

    1. declare a global variable that will be available from any module

    2. set value of an unbound control on one form based on selection in another form
    This can be done by reference in ControlSource to a control on another form but requires the other form to remain open.
    Use VBA to set value of control - which form the code is behind determines syntax of form and control references.
    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. Forms and Subforms
    By jlgray0127 in forum Forms
    Replies: 3
    Last Post: 04-11-2013, 02:24 PM
  2. Replies: 5
    Last Post: 01-16-2013, 03:48 PM
  3. Replies: 5
    Last Post: 10-27-2011, 01:00 PM
  4. forms and subforms
    By phineas629 in forum Forms
    Replies: 4
    Last Post: 10-05-2011, 02:46 PM
  5. Help with Forms and Subforms
    By xstaceyid in forum Forms
    Replies: 1
    Last Post: 04-21-2011, 02:14 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