Results 1 to 13 of 13
  1. #1
    rosefield is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    9

    Auto populate not working in form

    I have a database for animals. In the main table I have fields for the sys_id, animal_name, and animal_regno. Further down in the table I have fields for the sireid, sire-name and sire-reg-no. I have performed a query to pull selected fields out of this primary table and have saved it. One thing that I have noticed is when I go to the relationships window and create the relationship between the main table and the qry table by the sys_id field that it does not display a one-to-one or a one-to-many relationship. Should it? If so what would cause it not to?



    I have created a combo box on my form and used the qry for the data that I want. This part works fine and it does display the data like I need.

    In the form I rename the Combo88 to cbo-sire-id and then the other fields associated with this information I have put the words txt in front of them. Then I have the combo box highlighted and select "Event" and then select "On Change" and this is what I have put in the coding:

    Private Sub cbo_sire_id_Change()
    Me.txt_sire_name.Value = Me.cbo_sire_id.Column(1)
    End Sub

    But whenever I try to use the combo box, the auto populate does not work.

    Thinking that it could be because of the hyphens and underlines, I have even gone back and renamed the fields with letters only such as txtsirename, etc, but this still did not make any difference.

    Also thinking that it could be a possibility that the number of fields in the form could be the problem, I have created a form with just the few fields involved. That didn't work either, as the auto populate still failed.

    Thanks and hopefully someone can answer with a solution.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Combo Box Controls depend on their Row Source property to retrieve data from a table or query. The column Count property will determine how many columns comprise the combo. The Column Widths property will display the data retrieved.

  3. #3
    rosefield is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    9
    The fields in the query are from the same table, so their is no difference in their size of type. The sys_id field in the main table is an auto number and the other field are text fields.

    All fields that the auto populate is supposed to input the information into are also text fields of the same size.

    I copied the main table over to another database, recreated the query and did the very basic form with the fields. Doing everything exactly as I described above the auto populate worked. I cannot understand WHY it does not work in the database that I need it to.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    For starters, I'd use the after update event of the combo; the change event fires with every keystroke. Second, ItsMe mentioned the column count property, and you didn't say what it is. If it's not correct, your code can fail. In your case, it needs to be at least 2 for column(1) to work. It should be the number of fields returned by the row source.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    rosefield is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    9
    In the query I have selected sys_id, tag_code, animal_name, animal_regno, sex

    In the query design, I have the sex field set not to display and it is to only display in the criteria as =BULL

    The field columns are in the exact order as listed above. When I set the combo box the only fields that are available are the sys_id, tag_code, animal_name and animal_regno The sex field does not show because it is a hidden field.

    When I try the combo box the correct information is displayed. In the Event / On Change as I mentioned above I have three entries for the auto populate and they are in the same order as the columns as well and they are reference to as Column(1), Column(2) and Column(3)

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    What is the Column Count property of the combo??
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    rosefield is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    9
    the column count is 4.

    I do have in the "EVENT / ON CHANGE", a reference to the Columns as (1), (2), (3) Of course each of these entries are on single lines and are the statement as in my first post. Everything that I have read says the the first column is referred to as 0.

    I have about 12 or so other combo boxes in this form as well. I am wondering if having other combo boxes in the form could be causing the issue? Is there a command to use that would clear any previous references to other combo boxes if that is a problem?

    As I mentioned I copied the table and re-created the query in another database. I created a simple form with just a few fields and in that form I only have the one combo box that is for the auto populate. The auto populate works in the test site.

    I have also checked the form properties and the combo box properties and both are exactly the same, nothing is set any different.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    rosefield is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    9
    The database has some private information that prevents me from being able to post it.

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    I'm not convinced we're on the same page. I'm not asking how many columns are in the combo, I'm asking what its Column Count property is. They aren't necessarily the same, and is the "usual suspect" when this fails.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    rosefield is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    9
    When I go to the live form and select this combo box, there are 4 fields that display, sys_id, animal_tag, animal_name, animal_regno In the query table there is a hidden field that is the sex field that I have used to filter so that only the BULLS can be selected for the sire.

    In the form properties box it also says there are 4 columns.

    Like I keep saying, when I copied the primary table, recreated the query and did a very small form for what i needed, doing the steps as I have outlined here everything works.

  12. #12
    rosefield is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    9
    Like I mentioned, I copied the table into another database, recreated the query and the simple form and the auto populate worked.

    I just copied the query, did the relationship of sys_id in the primary table to the sys_id in the query table, copied the simple form from the other database and the auto populate does not work in this database.

    I cannot see any difference in the info in the database table

  13. #13
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    There may be an issue of a reserved word in your query that is included in the first DB but not the test DB you created. Not sure what you mean by Auto Populate. Either you see results in your combo or you do not. If you are typing into your combo and do not see possible matches, that is a property setting.

    The form has its own properties. Each object on a form has its own properties. In your form's "Design View" you can view the properties for these objects in the properties sheet. Highlight an object/control and view the sheet while the object/control is still highlighted. Click the tabs within the property sheet to see properties relevant to "Format, "Data", Other, etc.

    If you are having trouble with your combo's properties, post the RowSource here. If the Rowsource contains a Named Query, post the SQL of named query here.

    You should see some sort of results adjusting the following
    Row Source
    Column Count
    Column Widths

    You may need to make sure other properties did not get adjusted from their default
    List Rows
    Row Source Type
    Auto Expand

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

Similar Threads

  1. Replies: 2
    Last Post: 04-15-2014, 10:03 PM
  2. How to auto populate a form
    By e51lrrp in forum Forms
    Replies: 42
    Last Post: 03-20-2014, 11:40 PM
  3. Sub Form auto populate
    By keiath in forum Forms
    Replies: 4
    Last Post: 02-14-2014, 02:59 PM
  4. How to auto populate in tex box form
    By kft10 in forum Forms
    Replies: 3
    Last Post: 06-12-2013, 11:47 PM
  5. Auto Populate form
    By fpsmi in forum Access
    Replies: 1
    Last Post: 09-16-2011, 09:24 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