Combo Box Problem

kryten

Registered User.
Local time
Yesterday, 23:56
Joined
Jul 24, 2004
Messages
40
Hi everyone,

I have a combo box which looks up customers in my customers table and fills in the customer details on my orders form. However, the customer information that it enters on the form isn't saved, each time I select a different customer from the combo box that customer's details appear in every record. Here is the after update code I'm using to fill in the details:

Private Sub Cust_AfterUpdate()
Me![CustID] = [Cust].Column(0)
Me![Name] = [Cust].Column(1)
Me![Address] = [Cust].Column(2)
Me![Area] = [Cust].Column(3)
Me![Area2] = [Cust].Column(4)
Me![Town] = [Cust].Column(5)
Me![PostCode] = [Cust].Column(6)
Me![Country] = [Cust].Column(7)
Me![PhoneNo] = [Cust].Column(8)
Me![Advert] = [Cust].Column(9)
End Sub

I hope someone can help, many thanks in advance.
 
Since you already have the customer details in your Customer table you only need to store the Customer ID in your Orders table. the customer ID should be the bound column on your orders form.
 
Combo Box

Thanks for your reply.

I need to see the customer details on the form so that this information can be printed with the order.
 
Hi there,

Why not base your form on a query that links the order table with the customer table using customer ID ? When you select a customer all the related fields will fill in automatically.

Or you could put a DLOOKUP function in the Name, Address, Town, Postcode etc fields which will pull data from the customer table once the ID has been filled in.

The query way is the simplest (requires less coding anyway).

Cheers,
StepOne
 

Users who are viewing this thread

Back
Top Bottom