Updating Textboxes based on Combo Box Selection

G

Guest

About 2 weeks ago, I started designing a custom check printing system.

It has come down to only 2 tables:
Check - Basically the ongoing table that will keep track of every check
generated
Transactions - Lists each itemized items and the amounts for each.

This current setup allows me to enter a new record to Check (Autonumber is
used as the Check Number) by typing in Customer Name, Address, etc. and enter
the individualized items in the transaction subform.

As you can see, this method will require me to enter the Customer Name,
Street Address, City, State, Zip Code for every new Check written. Fairly
tiring and inefficient when ongoing checks to repeated Customers will be
written to from time to time.

So I generated a Customers table that has the 5 fields listed above and
using CustomerName as the Key (Some test data filled in). I then used the
Combo Box Wizard to generate a Combo Box that pulls the Customer Names and
then can save the selected data into "one" field on the Form, so naturally, I
picked that it should Save the selected value to the Customer Name field (to
be saved into the Check table). Well, this part worked, and as soon as I
selected a Customer Name in the box, the Customer Name is filled in and
updated as I change the selection.

Now I what I would like to do is so that every time the box is selected with
a Customer Name, all the other 4 Textboxes will be updated with their
respected values (pulled from the Customer table). But I could not get any of
the 4 to work. I found a similar situation in the Northwind Sample Database
that comes with Access under the Order Form. Where once a Customer is
selected in the combo box, the Shipping Address fields are automatically
updated. I tried to apply the principle for the Afterupdate property for that
Combo Box to my own system, but still doesn't work.

So by going back and forth with the design/form view.... The Check table is
now being populated with a long list of records showing only the Customer
Name (pulled from the Customer Table), with the rest left blank because they
were not pulled from the Customer table and entered as new data into the
Check table.


What might I be doing wrong and/or overlooking?

Any help/suggestion is truly appreciated.

Sorry if the thread is a bit long and I thank you for your time in reading.
 
G

Guest

Maybe I read your "novelle" to quick ;) but I think you can use something
like this:

Private Sub cboName_AfterUpdate()

cboNameToUpdate = Null
cboNameToUpdate.Requery
cboNameToUpdate = Me.cboNameToUpdate.ItemData(0)

End Sub
 
G

Guest

Thanks for actually taking the time to read the piece. I apologize for I feel
like I am about to do another one....><
But I feel I'd like to clarify a few things.

Here are the settings involved

Tables:
- Check Table (Controlled by the Check Worksheet Form)
(CheckID (Key), Customer Name, Street, City, State, Zip)
- Customer Table
(CustomerName (Key), CustomerStreet, CustomerCity, CustomerState, CustomerZip)

Form Fields involved on the Check Worksheet Form:
Customer Name (Text Box)
Street (Text Box)
City (Text Box)
State (Text Box)
Zip Code (Text Box)

Combo Box (Grabs CustomerName from the Customer Table)

The current set up is:
As soon as the Combo Box selection is made, a New record will be added to
the Checks table. The Customer Name Text Box is updated with the Combo Box
(this part works as the Customer Name Text Box is constantly changed to
reflect the selection by the Combo Box).

What I would like to accomplish is:
for the rest of the 4 Text Boxes (Street, City, State, and Zip Code) to be
updated with row data in CustomerStreet, CustomerCity, CustomerState, and
CustomerZip just like Customer Name is constantly being updated as a
different selection to the Combo Box is made.

As I've mentioned:
The Event Procedure for the Combo Box that list the Customers on the Order
Form in the Northwind database had something similar to what I am looking for
where when a Customer is selected, the address textboxes (or labels) are
constantly updated based on the combo box selection. But I could not get that
same principle to apply to my own form.

Please help

Thanks again
 

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