Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto Fill

Status
Not open for further replies.

ange71

IS-IT--Management
Dec 10, 2001
9
GB
Hi

I would like one of my forms to auto fill some details [customer address] based on details entered on another form.

The Ffirst form [CustomerDetails] contains all the customer info and is linked to a second form [Order] which in turn has a sub form [OrderDetails]. On the [Order] form there is a section to enter delivery details - I would like these to auto fill with the details entered on the [CustomerDetails] form.

can anyone help??
ange
 
I have a sample database that I am writing that does include samples of what you are asking...if you would like a free copy for you to look at no problem...A friend helped me write it so I don't know all the ins and outs. Also there are a few bugs in it I am trying to work out.

CK8

 
There are several ways to do this.

On the Load event of the Order form:
Code:
Me.DeliveryAddress = Form_CustomerDetails.Address

In the Control Source of an unbound text box:
Code:
  =[Forms]![CustomerDetails].[Address]

On the command button that opens the Order form:
Code:
  Private Sub cmdOpenOrderForm_Click()
    DoCmd.OpenForm "Order"
    Form_Order.DeliveryAddress = Form_CustomerDetails.Address
  End Sub

The issues to consider are whether the calling form (CustomerDetails) will remain open in the background to reference its field values. And, whether you want the info to be displayed in an unbound textbox for user convenience or actually added to a table.

Having the same address in two tables runs against normalization practices. However, I've found that addresses for deliveries and pickups usually have to be handled this way for accountability.

If you make a delivery to a customer's address in January and they move in February, you don't want an update to their new address to affect the delivery record. You still need a record of where you actually made the delivery in January.


HTH

John

Use what you have,
Learn what you can,
Create what you need.
 
If you happen to be using Access2000 (at least), it has an "autolookup" feature that is rather well explained in "help." Select the help index, select "automatic", then "search", and the first article is about Autolookup.

Your tables should have a one-to-many relationship. Gus Brunston :cool: An old PICKer, using Access2000
padregus@attbi.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top