combo box data type

  • Thread starter Thread starter achang418
  • Start date Start date
A

achang418

i am trying to have 2 combo boxes, 1st box is to display boxNumber,
2nd combo box is to display ChipID based on the selection of 1st combo
box... 1st combo box is getting list of value from a table which
stores number values. This works fine as i can link to table.field and
get the numbers to show on the drop down. Then,
I have "AfterUpdate" event with combo1. and here's SQL to display
value in combo2 (ChipID).
Me.Combo2.RowSource = "SELECT ChipID from ChipID " & _
"WHERE BoxNumber = " + Me.Combo1 + " AND ChipDateOut IS NULL "

However, i am getting "Type mismatch" error...
I noticed Me.Combo1 is showing the value without the double quote (").
For example, combo1 value=1, it's showing just 1 instead of "1" in the
runtime mode.
if i replace combo1 with text1 (a new text box) and put in 1, it would
display as "1" in the runtime and SQL would work.

anyone has any ideas what's wrong?!
Appreciate any input and help!
 
On Tue, 10 Nov 2009 18:18:32 -0800 (PST), "(e-mail address removed)"

In VBA, the string concatenator is "&", not "+".

Are you really sure you have a table named "ChipID" with a column
named "ChipID"? That's highly unusual and NOT recommended - if it is
even legal.

What is the RowSource of your first combobox? Me.Combo1 will retrieve
the bound value. To check what it is, when you have the form open, hit
Ctrl+G to go to the Immediate window where you can type:
?Me.Combo1

-Tom.
Microsoft Access MVP
 
Back
Top