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

    Combo box in a form. HELP!

    So im very new to Access and trying to wrap my head around it...but access is winning. i remember taking VB courses 6 years ago but i havnt used it since and its foggy in my memory.

    Basically i have Form that i want to pull specific data from a single table when i select from a drop down box, so im guessing that onchange would be used and a bunch of if statements??
    here is a sample(not the actual table) but close to what it will look like.

    Click image for larger version. 

Name:	name.jpg 
Views:	15 
Size:	36.4 KB 
ID:	14735



    this is what it looks like...i would like it to pull information from my table once something has been selected from the combo box



    Click image for larger version. 

Name:	Capture.JPG 
Views:	15 
Size:	29.9 KB 
ID:	14737

    so for example-
    combo box = surgical specialists then i would need it "find"the practice manager of surgical specialists and place it in the Practice manager field


    same with the phone number, fax, ect...
    any help is appreciated!!
    Last edited by jwright; 12-11-2013 at 09:10 PM. Reason: edit pic

  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
    Knowing VB doesn't necessarily prepare for understanding relational database.

    What do you want to do with the 'pulled' data? Should NOT be saving it into another table - that is duplication of data.

    If you only want to display the related info, there are several ways to accomplish.

    1. set the combobox as multi-column - the additional columns for the related info, then textboxes can refer to the columns to display
    column index begins with 0 so if address is in column 2, the expression would be like:
    =[comboboxname].[Column](3)

    2. include the Name in form RecordSource by join to table that is the primary data for the form, join type 'Include all records from {primary table} ...'
    bind textboxes to the related data fields and set them as Locked Yes, TabStop No

    3. DLookup() function

    Also, review http://www.datapigtechnologies.com/f...tomfilter.html
    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
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Do you have a good description of your Business and the business rules? Do you have a data model?
    Does the model support the Business? Have you tested your model against your Business rules?

    Getting your structures - tables and relationships - set up properly is critical to database success.
    Forms and interfaces are important, but in my view, come after tables and relationships.

    Here is a tutorial to put all this into context. Good luck.

  4. #4
    jwright is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    2
    i did some coding this morning and this worked. afterupdate pulls info from my table based on the value and fills in the text boxes, but i dont think it is very efficient. Currently seeing if i can do the same for the employees to be added into a text box that are associated with the ComboBox. like i said im new to it and will be taking the advice above ^ thanks!
    Click image for larger version. 

Name:	VB.JPG 
Views:	10 
Size:	98.9 KB 
ID:	14746

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I think code in this case is like driving an Indy 500 car to the grocery store.

    I gave you 3 options that did not involve VBA code.
    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: 7
    Last Post: 10-03-2013, 03:10 PM
  2. Replies: 1
    Last Post: 10-30-2012, 10:29 AM
  3. Replies: 5
    Last Post: 03-12-2012, 02:58 AM
  4. Replies: 5
    Last Post: 01-02-2011, 10:09 AM
  5. Replies: 0
    Last Post: 08-17-2008, 12:19 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