Results 1 to 3 of 3
  1. #1
    zashaikh is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2017
    Posts
    182

    Auto-filling in forms

    Hello.



    I am trying to make a Form that will auto-fill all of the fields after I type in the information for the first field.

    For example, lets say I have a a Form linked to a SINGLE table. The Table is called "StolenCars"

    In my form, I have the following fields "Model" "Make" "Country of Manufacturer", "NumberofTires", "Year" "Location Stolen"

    I want to be able to type in the "Model field", and then have the "Make" "Country of Manufacturer" and "NumberofTires" field automatically fill. In other words, if I type in "Caliber" I want it to auto fill with "Dodge" "USA" and "Four". I will enter the "Year" and "Location" myself.

    All of these fields exist in the same table. I have been watching tutorials online, but have not been able to auto populate my fields.

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Use the form's Filter property. In the AfterUpdate event of the Model field, add this code:
    Me.Filter="Model='" & Me!ModelField & "'"
    Me.FilterOn=True
    Me.Requery

  3. #3
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,463
    Do you have another table that is a master list of the Model, Make, Country or you just using the records in your one table? Let's say you are using the 1 main table. Create a combobox from table StonelCars, add fields: Model, Make, Country Of Manufacturer and NumberofTires, do a Totals/GroupBy on all fields so you get unique list, make sure the bound column is 1 to point to the Make field. Then in the AfterUpdate on this Make combo box, put this code:

    If not isnull(me.Model) then
    Me.Make = me.Model.column(1)
    me.[Country Of Manufacturer] = me.Model.column(2)
    Me.NumberOfTires = me.Model.column(3)
    Me.CarYear.Setfocus
    Else
    Me.Make = null
    me.[Country Of Manufacturer] = null
    Me.NumberOfTires = null
    Me.Model.Setfocus
    End If

    EDIT: Looks like aytee111 example is if you are trying to pull up a record(s) on the form based on Model, my code is if you are entering data into a recordon the form itself. You might need a combination of the 2 as you will want to add records but also look records up maybe by model type?

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

Similar Threads

  1. macro auto filling
    By chr1stoper1 in forum Macros
    Replies: 6
    Last Post: 09-12-2015, 10:32 AM
  2. Auto-filling data
    By Ranger7913 in forum Programming
    Replies: 3
    Last Post: 01-12-2015, 03:26 PM
  3. Replies: 9
    Last Post: 04-17-2013, 03:55 PM
  4. Auto filling a field in a table. Help please
    By tdanko128 in forum Access
    Replies: 2
    Last Post: 01-18-2011, 12:22 PM
  5. Auto Filling
    By tgavin in forum Forms
    Replies: 2
    Last Post: 08-02-2010, 10:47 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