Combo Boxes

L

Lele

My combo box has the following 3 columns:
FabricID (which is an autonumber), Pattern, Color
Typical data could look like this:
1, Plaid, Green
2, Plaid, Yellow
3, Stripe, Green
4, Stripe, Red

The fabricID identifies a unique combination of pattern and stripe.
I want the user to start to type in the pattern while the system assists
with an autofill but I need the the fabricID field to be the bound and stored
value.

How do I make this work? So far all I get is errors
 
W

Wayne-I-M

Hi Lele

Create a new query - call it qryPatColSearch

In the query you need 3 columns
col 1 = Pattern
col 2 = Colour (or Color in the USA)
col 3 = FabricID

Save the query

Create a new combo on your form call it - cboPatColSearch
Open the properties box for the combo

In the Data Column
Row Source Type = Table/Query
Row Source = qryPatColSearch
Bound Column = 3
AutoExpand = Yes


In the Format Colum
Column Widths = 2.54cm;2.54cm;2.54cm (this is the standard access size - can
be change if nes)

In The Event Column
Selet the AfterUpdate row and click the build option (...) - select code and
insert this.

Private Sub cboPatColSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[FabricID] = " & Str(Me![cboPatColSearch])
Me.Bookmark = rs.Bookmark
End Sub


The above code will work as the bound column has been set to 3 which is the
FabricID column in the query.

Hope this helps
 
B

BoniM

Hide the FabricID column - in the field properties, bound column is 1, column
count is three, but for column widths enter 0";0.5";0.5" (or measurements
that would work) - set the list width to 1" for this example. The key column
is still the bound column and is stored in the table, but the pattern column
will now allow them to start typing plaid to have the first choice
displayed...
 

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