Results 1 to 2 of 2
Thread: Combo Box (2003)
2007-12-13, 20:52 #1
- Join Date
- Jan 2001
- Thanked 0 Times in 0 Posts
Combo Box (2003)
I have a combo box on a form where they select a client number and the client numbers information comes up on the form. I selected two fields for the combo box - the client number (which is first) and then the name. I want them to be able to put a letter in the combo box and bring up those records starting with G for instance but that would mean putting Client name first. The problem is some of the names are not unique so I need the combination of the client number and name to get the right record. I used the wizard to create the combo box. This is the code Access generated:
Private Sub Combo63_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Affcl No] = '" & Me![Combo63] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
How could I use CLname first so they can search and also use "Affcl No" to make sure I get the right record?
2007-12-13, 21:04 #2
- Join Date
- Mar 2002
- Thanked 28 Times in 28 Posts
Re: Combo Box (2003)
Set the properties of the combo box as follows:
In the Format tab of the Properties window:
Column Count: 2
Column Widths: 0";1" (or similar)
In the Data tab of the Properties window:
Bound Column: 1
These settings mean that the combo box will display the client name, but the value of the combo box will be the corresponding client number.
The user can type the first letters of a client's name, the combo box will jump to the first matching name.