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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

POPULATE REST OF FIELDS WHEN DATA TYPED IN

Status
Not open for further replies.

baybie

IS-IT--Management
Oct 5, 2002
68
GB
I have a Customer form with fields like CustomerName, Customer ID, CompanyName, CompanyAddress, Postcode. I would like to create a form from the following but i would like the fields to be blank as default but when i type in either the CompanyName or CustomerName in the appropriate fields i would like all the fields to be populated with the relevant details. Taking into consideration that the two fileds will be Lookup Fields.
Is this possible, Or knowing what i'm trying to do would anyone have another suggestion for this?
This is for an order database, i would like the users to be able to type in the clients or company's name and then the fields would be populated automatically, they can they input the product details for the order but still maintain the relationship between the client and the order.
 
Hi,

There may be more elegant ways of doing this, (and there WILL be other ways), but here is how I would do it....

Have a button on the main form that:
[tt]
a)Checks the relevant field (Company Name OR CustomerName)
has been filled in.
b)It then calls either one of 2 small forms dependant on
whether Customer or Company is required, and each has
all the Customer or Company fields on it, and each has a
sql statement to populate it's fields similar to:
'select * from tblCustomer where CustomerName = mainform!
txtcustomer'. (for Customer form)
'select * from tblCompany where CompanyName = mainform!
txtcompany'. (for Company form)

These small forms then copy each field across to the main
form fields.
The small form closes itself down.
[/tt]

The user won't see the 'hidden' small form because it happens in a blink.

Have a go at this, and re-post if you have probs.

Regards,

Darrylle "Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
Base your form on a query that has the foreign key in it (e.g., CompanyID) then delete the foreign key field from the form and, in its place, create a field (e.g. combo box) based on the related primary key. When the user enters/selects a value in this field all other fields on your form (the ones whose data is contained in the primary key table) will automatically populate. Ann
 
Thanks guys, I'll let you know how i get along.

Andrew Ezea
(Assetbase)
In search of the Perfect Database.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top