Results 1 to 4 of 4
  1. #1
    AccessNewb11 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    23

    Combo Box Auto Populate-Applies to EVERY Record

    Hello,
    I am having a problem with my DB. I am building a database to help me register people for law enforcement classes. I created tables with info., and a master form to use to register students. Please see my attached database as a sample of what I am talking about.

    Please open the form titled "April 30". On this form, I created a combo box for Agency Info., Contact Name and Date of Class. When I select an agency and a contact person, for instance "Police Department" and "Jane Doe", it automatically fills in all of the relevant information. However, it is applying those selections to both my records. Why is it doing this?! i.e. if I were to select "Police Department" and "Jane Doe" for record 1, and "Sheriff Department" and "John Doe" for record 2, they won't stay that way-the selections are being applied to ALL records. Does this make sense? Please view my database to get a view of what I mean.

    Please help!
    Thank you!



    ~Access Newb~
    Attached Files Attached Files

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    I did not download your db but I suspect the problem is with your code to populate the lookup fields. Assuming your form(s) are linked correctly and you have a Primary Key.
    Also, I assume your fields are bound controls.





    HTH
    Last edited by burrina; 05-22-2014 at 11:38 AM. Reason: Explanation

  3. #3
    AccessNewb11 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    23
    No, the fields are unbound.

    Here is my code to populate the fields:

    Private Sub cmbAgencyInfo_AfterUpdate()
    Me.txtCounty.Value = Me.cmbAgencyInfo.Column(1)
    Me.txtAddress.Value = Me.cmbAgencyInfo.Column(2)
    Me.txtCity.Value = Me.cmbAgencyInfo.Column(3)
    Me.txtState.Value = Me.cmbAgencyInfo.Column(4)
    Me.txtZipCode.Value = Me.cmbAgencyInfo.Column(5)
    End Sub

    Private Sub cmbagencycontact_AfterUpdate()
    Me.txtphone.Value = Me.cmbagencycontact.Column(2)
    Me.txtEmailAddress.Value = Me.cmbagencycontact.Column(3)
    Me.txtTitle.Value = Me.cmbagencycontact.Column(4)

    End Sub


    And yes, I believe they are linked correctly and there are Primary Key's.

    Don't know what I'm doing wrong....hm.

    Thanks.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    What is purpose of April30 form? Which table do you want to populate? Are you trying to create new records in Individual table? The form is bound to Individual table.

    The Agency combobox is not bound to a field. What purpose does this combobox serve? Same for the Contact, Name of Class, Date of Class comboboxes.

    The RecordSource for this form includes the Notes table and should not. Notes should be a subform.

    I suspect you are really trying to create records for Jointbl_Individ_ClassID. Data entry options are:

    1. single form bound to Jointbl_Individ_ClassID with comboboxes to select IndividualID and DateOfClassID

    2. main form bound to Individual and subform bound to Jointbl_Individ_ClassID with combobox to select class/date

    3. main form bound to tblDateOfClass and subform bound to Jointbl_Individ_ClassID with combobox to select individual

    Instead of using code to populate textboxes with the values from comboboxes, use expression in textbox ControlSource: =[cmbAgencyInfo].[Column](1)
    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: 3
    Last Post: 06-12-2013, 06:44 PM
  2. Auto Populate based on Combo box
    By Mpike926 in forum Forms
    Replies: 16
    Last Post: 09-07-2012, 03:16 AM
  3. Auto populate form using combo box
    By bundy75 in forum Access
    Replies: 6
    Last Post: 08-29-2010, 06:18 AM
  4. auto populate combo field?
    By myboii in forum Access
    Replies: 8
    Last Post: 07-09-2010, 05:46 AM
  5. Auto-Populate Combo box
    By vincenoir in forum Forms
    Replies: 3
    Last Post: 10-14-2009, 07:06 AM

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