Results 1 to 4 of 4
  1. #1
    Deweyusa is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    2

    Beginning forms. How to access another table with a combo box?

    Hi.

    I have what seems like it should be a beginner Access question. I have an extremely simple database for a magazine. It has a table of stories to be written, a table of people, and a table of roles those people can play (there are 3: author, photographer, and editor). There is a junction table between all three aforementioned tables to link them together.



    I would like to have a form that allows me to cycle through the stories and enter relevant information. No problem when that info is in the Stories table. However, on this form, I would like a combo box that allows me to select from the people table and assign people to their various roles for each story. This should update the junction table with that persons role when it is chosen.

    I quickly realized that to have the information available in the form, I'd need to modify its Control Source with a query of my own, rather than use the default Wizard-created Stories table as a Control Source. However, when I did that, I realized I had numerous results in the query for the same story (where, for example, I one result with story 1 and a role of photographer, then another result with story 1 again, with the assigned author). As I then cycled through the records on the form, I wasn't seeing each story, but rather each result from the query. I know, this is simple stuff, but I'm new to forms. If I take out the custom query, I lose that role information within the form.

    Is my solution a different query, a different organization of the relationships/table structure in the database, the use of DLookup for the combo box, a form based on a different table, or some other method? I realized this may be an instance where a subform would help (show the junction table there), but ideally, I wanted to not show a subform, as this seems kind of cluttered to me. Does doing it the way I'm suggesting (in a combo box) add the requirement of a lot of background VBA magic?

    Thank you for any help. Here is a snapshot of the relationships, and attached is the database with a bunch of stuff from the Stories table stripped out to just illustrate the point.

    Writing Database.zip

    Click image for larger version. 

Name:	dbase_shot.png 
Views:	13 
Size:	18.5 KB 
ID:	34124


    -Dewey

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Not sure why you feel a form/subform arrangement is 'cluttered'.

    Main form bound to Stories. Subform bound to RolesStoriesPeople. Two comboboxes to select Role and Person.

    Otherwise, a form bound to RolesStoriesPeople and 3 comboboxes to select values.

    Comboboxes can be multi-column in order to display related info from the 'lookup' table in the dropdown list.

    Most experienced developers would break a name into multiple fields: FName, MName, LName
    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
    Deweyusa is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    2
    I see where a subform would work, I just figured a separate window showing one would seem a little, well, cluttered, but I didn't consider that perhaps I could alter (or get rid of) the subform's border, which might be just fine for making it "blend in" to the main form. That might work.

    But also out of curiosity, I wondered if what I'm trying to do is even possible, or if it's just an unusual way of trying to do things. I read somewhere else on this forum that generally, one form is tied to one table. Is that common practice?

    Thanks for your response!

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Yes, usually one form for data entry/edit to one table (I do have a db that does allow edit of existing records from multiple tables on one form because of 1-to-1 relationship but, yes, that is unusual). The lookup tables can be included to display related info but do not allow data entry/edit via the same form.
    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: 03-17-2017, 07:01 AM
  2. Replies: 5
    Last Post: 12-01-2015, 02:22 PM
  3. Replies: 7
    Last Post: 06-25-2013, 07:55 PM
  4. Beginning user to Access
    By clbaldwin@alaska.edu in forum Access
    Replies: 3
    Last Post: 01-20-2013, 06:59 PM
  5. Beginning and balances in Access 2007
    By jalovingood in forum Access
    Replies: 1
    Last Post: 04-19-2011, 03:34 PM

Tags for this Thread

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