How to..

  • Thread starter Thread starter Dragan
  • Start date Start date
D

Dragan

I maked the tables in access (named ProductID and Products ). Than I put
combo box on the form and linking them with tables ProductID and Products. I
put on the form a field for Products.

For example:

ProductID Products

CPUIP380 Intel Pentium 3.80
CPUIP360 Intel Pentium 3.60
CPUIP340 Intel Pentium 3.40
CPUIP300 Intel Pentium 3.00
CPUIP280 Intel Pentium 2.80
MBASUSP5AD2P Motherboard ASUS P5AD2-E Premium
MBASUSP5AD2 Motherboard ASUS P5AD2 Premium
MBASUSP5GD2 Motherboard ASUS P5GD2 Premium
MBASUSP5GDC Motherboard ASUS P5GDC Deluxe




When I click combo box on the form I have alphabetical list of ProductID.
When I click ProductID in combo box (for example CPUIP380), their name
(Intel Pentium 3.80) appear in the field (Products) on the form.

My question is... How to get Intel Pentium Products only when I write to
combo box ProductID (for example CPUIP380) without Motherboards?

How to make this?

Thanks.
 
Hi Dragan, if you use a query for the combo box you could filter for
products that have "Intel Pentium" in the "Products" field, ie

Select ProductID, Products from MyProductsTable where Products like "Intel
Pentium*"

Also, you could do away with the onClick code and have the control source as
=MyComboBox.Columns(1)

Regards
 
Hi, Dragan.

With your current table structure, you can show all the Intel products by
adding a WHERE clause to the combo box' RowSource query statement:

WHERE Left([Products].[Product],5) = "Intel"

Note, however, that this will not display misspellings, or spaces, such as:

Entel
Intel
In-Tel
In tel

It would be more foolproof if you had a Manufacturers table, and a foreign
key to MfrID in your Products table.

Manufacturers
------------------------
MfrID AutoNumber
Mfr Text
Address Text
City Text
....
Etc.

Products
--------------------
ProductID Text (PK)
Mfr Integer
Product Text
....

Then you could reliably input the manufacturer of each product, and use a
simpler WHERE clause:

WHERE [Products].[Mfr] = x, where x represents the MfrID for the
manufacturer of interest.

Hope that helps.
Sprinks
 
My form looks like:

On the first row I put 2 fields (the first field is ProductID and second
field is ProductName).

The first field (ProductID) is the combo box. When I write 3 first letters
(for example: CPU for Processors) in the field ProductID and I click drop
menu of combo box, I have all alphabetical list of ProductID with all
products. I dont want all list of productID just list of all productID for
processors. Same think for Motherboard (I write MB = all list of
motherboard), keyboard (I write KEY = all list of keyboards) etc...

How to make this?

Thanks
 
Back
Top