Results 1 to 3 of 3
  1. #1
    hilian is offline Advanced beginner
    Windows XP Access 2003
    Join Date
    May 2012
    Posts
    44

    Question Populate unbound combo box when reviewing data

    In my db, there are agencies, which can have one or several programs, programs that can have one or several cases and cases that can have one or several episodes. Agencies, Programs, Cases and Episodes are tables linked on one-to-many relationships.

    I am trying to set up a form that displays all of the information for a case: episodes, program and agency. I have a form for cases with a sub-form for episodes. That part works; when I scroll through the cases, the combo box for Programs populates, but I don’t know how to get the combo box for Agencies to populate. Agencies is linked to Programs by primary key/foreign key, and Programs is linked to cases the same way, as are cases and episodes. The Agencies combo box is unbound because there is no need to store Agency information in the cases table.

    I can live with this for date entry. The user selects an agency, and a dependent combo box limits the selection to its programs. The problem occurs when the user needs to review or correct case information. Then the Agencies combo box doesn’t populate, leaving the information incomplete.

    I know that there’s code that will populate the Agencies combo box, but I can’t figure out what it is. I’ve tried the DLookup function, but I can’t get the syntax correct. Is this the best way to do it, or if not, what is?

    Thanks,



    Henry

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    If I understand your scenario correctly, it sounds as if using DLookup would be valid; what code syntax are you using that isn't working?

    Linq ;0)>

  3. #3
    hilian is offline Advanced beginner
    Windows XP Access 2003
    Join Date
    May 2012
    Posts
    44
    Thanks for responding so quickly.

    In the after update event I entered:

    Me.tblAgency = DLookup([tblProgram]![AgencyFK])

    I also tried it in the On Change event, which I think is where it actually belongs, since I want the agency to change when the user scrolls through cases. It didn't work there either.
    Last edited by hilian; 12-05-2012 at 10:31 AM. Reason: I misidentified the event

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

Similar Threads

  1. Replies: 5
    Last Post: 11-27-2012, 03:56 AM
  2. Replies: 6
    Last Post: 04-27-2012, 01:31 PM
  3. populate unbound field
    By DCV0204 in forum Access
    Replies: 3
    Last Post: 03-16-2012, 02:41 PM
  4. Replies: 5
    Last Post: 06-22-2011, 08:47 PM
  5. Populate unbound listbox with VBA
    By usmcgrunt in forum Forms
    Replies: 1
    Last Post: 09-23-2010, 09:11 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