Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002

    Question Unanswered: Fill In Data Automatically in Form

    How do I get a form to automatically fill in other parts of the form? For example, an incident report where someone enters their name, the time, and the company involved. Once the company is selected from the combo box, the next 5 of the remaining ten entry blocks will automatically fill in from another table which contains all this data (like address, chief contact, main phone #, etc)

  2. #2
    Join Date
    Oct 2002
    Leicester - UK
    that depend a a few things,

    1. is it good enough that the user can see the data about the company, without that data being avalible from the record
    Yes-> use a subform
    No ->

    2. Is it acceptable if the data was linked to the record rather that accually in it?
    yes-> use a subform, and store the values used to query the subform to link the data
    No ->

    3. are you using the look up to validate the company name
    Yes->use a subform linked to a combo box that looks up the companies in the company table
    no ->you want the form to write the data to itself
    the fields that you want to be filled in should be disenabled combo boxes with the raw source data set to

    SELECT Customers.Address FROM Customers WHERE = [forms]![<formname>]![<comboboxname>];
    then on the on_update method of the combo box for the companies name add the code docmd.requery(<address combo box name>)
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  3. #3
    Join Date
    Feb 2002

    Post If you want the values from other table to be physically in this table then...

    Use Dlookup like this:

    ShippingAddress= DLookup("CustomerAddress", "Customers", "[CustomerID]=" & "[cboSearchby]")

    For more help just past the code above to your program then click on dlookup and press F1

    "customers" is the customers table
    "[cbosearchby]" is the combo box
    "customeraddress" is the field to retrieve from customer table
    "shippingaddress" is the field on the current form to fill in
    "[customerid]" is the field in the customer table to match the combobox

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts