AutoPopulate TextBox fields

R

Rick

On this form I have several TextBox fields for customer contact information,
(i.e. LastName, FirstName, CompanyName, Address, PhoneNo, etc).

When I open a new record to enter customer contact information, Id like the
form to automatically fill in the fields for repeat customers. I just don't
know how.

Any help with this would be greatly appriciated.

Thanks,
Rick
 
J

Jeff Boyce

Rick

It sounds like you want to duplicate information for repeat customers.
While this might be necessary if you were using a spreadsheet, Access is a
relational database, and it is neither necessary nor advisable.

Instead, if you are entering "customer contact information", you could have
a main-form/sub-form construction. The main-form would hold customer
information, and the sub-form would hold contact information.

At the top (in the header) of the main-form, you'd add an unbound combobox
that lists existing customers. That way, your users would pick an existing
customer and have all that customer's info displayed ... no need to re-enter
all that stuff!

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/
 
J

John W. Vinson

On this form I have several TextBox fields for customer contact information,
(i.e. LastName, FirstName, CompanyName, Address, PhoneNo, etc).

When I open a new record to enter customer contact information, Id like the
form to automatically fill in the fields for repeat customers. I just don't
know how.

Any help with this would be greatly appriciated.

Thanks,
Rick

These fields should be stored in your Customer table - and ONLY in the
customer table. If you're trying to store them redundantly in the
Orders table, *don't*!

Relational databases use the "Grandmother's Pantry Principle": "a
place - ONE place! - for everything, everything in its place." An
Order doesn't have a FirstName or a PhoneNumber; those are attributes
of a Customer, and belong in that table.

If you just want to display the information from the customer table on
the Form, you can use a Combo Box to select the customer; include the
desired fields in the Combo Box's Row Source query and put textboxes
on the form with control sources like

=comboboxname.Column(n)

where n is the zero-based index of the desired field; e.g. if the
CompanyName is the fourth field (after CustomerID, LastName and
FirstName) then use (3).

John W. Vinson [MVP]
 
J

John Dakin

I enter one time events in each record in a form view. Information in one field might need to be duplicated in another. For example a name or address may have to be repeated in the same record. How can I get a one time entry in one field to auto-populate into another field in the same record?
 
J

Jeanette Cunningham

Hi John,
it is easy to do.
Me.CopyOfAddress = Me.Address, use it in the after update event of the text
box called Address.
It will put the value of a text box called Address into a text box called
CopyOfAddress.

Change the obvious to suit the names of your text boxes.

If you are trying to store both copies of the address in the same table or
in 2 different tables, this is against the rules for designing databases
(except for some situations).
This creates the problem that every time a user changes the original
address, there needs to be code to change the address in the field which is
a copy of the address.
It can easily lead to inconsistent information - the address in one field is
different from the address in the other table for the same person.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top