Combo box

MattMG

New member
Local time
Today, 13:08
Joined
May 12, 2011
Messages
1
Hi!

Can someone please advise me of the best way to do the following:

1. I have 2 tables tblClients and tblQuotes and in tblQuotes there is a 'status' field (combo box with values e.g. approved, rejected, etc).

2. I want to create a form with a combo box on the top showing values from the 'status' field and the datasheet view of the remaining fields on the bottom.

3. The datasheet to show all quotes with the status shown in the combo box. It would also be nice to have first name and last name of the client (or the two combined into one Full Name).

What is the most efficient way of achieving these goals? Thank you!
 
Base the form on a query that combines the data from tblQuotes and the Client's name from tblClients.
Put an unbound combo in the header of the form.
The combo shows the status.

You can use the form's filter to show the records that match the status selected in the combo.

Here is some sample code that goes on the after update event for the combo:

Note: assuming that StatusID is the autonumber primary key of the status table and the quotes table has the field StatusID to show the status.
If Not IsNull(Me.[ComboName]) Then
Me.Filter = "StatusID = " & Me.[ComboName]
Me.FilterOn = True
End If

If the status is simply a text field in the quotes table, then the code would be more like:
If Not IsNull(Me.[ComboName]) Then
Me.Filter = "Status = """ & Me.[ComboName] & """"
Me.FilterOn = True
End If

 

Users who are viewing this thread

Back
Top Bottom