Restriction for choices option form (1 Viewer)

Robbin-R

student
Local time
Today, 22:00
Joined
Jul 13, 2010
Messages
9
Suppose I have two tables and a query:

tblCompanies


tblClients


These are related via a query:
qrySortContacts




I have a form to add orders. In this form both a customer and a client need to be chosen. I would like to restrict the options for Clients on the basis of the choice for Customer. Only those clients that work at the Customer chosen, can be chosen as Client.



I already have some code that works for the AfterUpdate procedure of Customer
Code:
Private Sub Customer_AfterUpdate()
    strSQL = "SELECT ContactID, FullName, CompanyID FROM qrySortContacts " _
        & "WHERE CompanyID = '" & Me.Customer & "'"
    Me.Client.RowSource = strSQL
    Me.Client.Requery
End Sub

But now I would like to assign the value of FullName (from qrySortContacts) to the Field of Client in the table for the orders.

The problem is that until now the value of ClientID is assigned to the field Client. It is the right ClientID, however I would like to have the client's FullName shown there.

Regards,
Robbin
 

vbaInet

AWF VIP
Local time
Today, 21:00
Joined
Jan 22, 2010
Messages
26,374
Look at the COLUMN COUNT and COLUMN WIDTHS properties of the Combo box.
 

Users who are viewing this thread

Top Bottom