Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2015
    Posts
    11

    Program forms to auto populate upon selection of specified criteria

    Hello! I'm creating a data form for a research project and I'm trying to utilize MS Access. I'll start right off with that I'm pretty much a novice with Access - I know how to do a lot, but I'm by no means an expert. I'm hoping that if I tell you what I want to do, someone can tell me how to do it (spell it out for me please!)

    I have created my table and my data form. My data form consists of several drop down box menus with preselected options. I'm wondering if there is a way to code/program the form so if N/A is selected in a specific field, it will automatically pre-populate in other fields as well.

    For example:

    If I the field box is "Was the treatment received" and the options are Yes and No. If No is selected, I would like any further form boxes pertaining to treatment to auto populate to N/A (which is an option in my combo box menu for these fields). To clarify: If I select NO in Combo Box 1, I want N/A to automatically be selected as the option for Combo Box 4,5, and 6. Make sense?



    Is there a way to do this? Your help is much appreciated!
    Last edited by elamadon0228; 07-28-2015 at 04:20 PM. Reason: Additional Information

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Welcome to the forum....


    I'm wondering if there is a way to code/program the form so if N/A is selected in a specific field, it will automatically pre-populate in other fields as well.

    Make sense?
    Sure.
    Should be able to use the after update event of the "Was the treatment received" combo box to change combo box 4,5, and 6 values to "N/A".
    What is the row sources for combo boxes 4, 5, and 6? Value list, a query?

  3. #3
    Join Date
    Jul 2015
    Posts
    11
    The row sources are value lists.

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    So you are storing text. OK, since I don't know your control names, the code would look something like this:
    Code:
    Private Sub cboTreatmentReceived_AfterUpdate()
    
        If Me.cboTreatmentReceived = "No" Then   '<<- change No to N/A ...not sure what you want here.  
            Me.cboCombo4 = "N/A"
            Me.cboCombo5 = "N/A"
            Me.cboCombo6 = "N/A"
        End If
        
    End Sub
    Change the control names to your control names.

    Could have
    Code:
    Private Sub cboTreatmentReceived_AfterUpdate()
    
        If Me.cboTreatmentReceived = "No" or Me.cboTreatmentReceived = "N/A" Then  
            Me.cboCombo4 = "N/A"
            Me.cboCombo5 = "N/A"
            Me.cboCombo6 = "N/A"
        End If
        
    End Sub

  5. #5
    Join Date
    Jul 2015
    Posts
    11
    This worked perfectly! Thank you SO MUCH!!! As a resident pharmacist working on her research project, the help from people who know far better than I is SO appreciated!!

    Thanks!

  6. #6
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You're welcome. Happy to help.

    Ready to mark this solved?

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

Similar Threads

  1. Replies: 1
    Last Post: 06-20-2013, 10:35 AM
  2. Replies: 25
    Last Post: 01-25-2013, 10:26 AM
  3. Replies: 1
    Last Post: 11-16-2012, 02:56 AM
  4. Replies: 2
    Last Post: 06-20-2012, 09:49 PM
  5. Replies: 2
    Last Post: 12-07-2010, 12:32 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