Type mismatch message

  • Thread starter Thread starter Slez via AccessMonster.com
  • Start date Start date
S

Slez via AccessMonster.com

I am getting the message "Type mismatch" when I try to run a report based on
what records are selected in a multi-select list box. I believe that the
problem may be stemming from my criteria statement as shown here:

For Each varItem In Me!lstBidSelect.ItemsSelected
strCriteria = strCriteria & ", " & Me.lstBidSelect.ItemData(varItem)
Next varItem

I copied this statement from a different location and adapted it, but my list
boxes are different. The original only had 1 column: BidNumber
The new list box, lstBidSelect, has 3 columns: BidNumber, BidType, BidStatus


Here is the Row Source of my multi-select list box if that helps:
SELECT Bid.BidNumber, Bid.BidType, Bid.BidStatus FROM qryBid WHERE (((Bid.
ProjectID)=Forms!frmMainScreen!cboProjectName)) ORDER BY BidNumber;

Do I need to reference which column the data is collected from for
strCriteria?...or is this error message a result of something else? If so,
what should I look for?

I believe that the issue is with my form's code because I can enter the
criteria directly in the query and the report runs perfectly.
Help is appreciated!
 
What is the data type of the field to which you are trying apply the
criteria?
Probably u are passing a string instead of a number.
 
In both applications, BidNumber datatype = Number (Byte)
The other 2 fields (the added columns) are Text.
 
Sorry for the delayed reply

I am assuming that u are passing the criteria to the bidnumber field

then your [strCriteria] should look like "[tablename]![bidnumber] = 1
or [tablename]![bidnumber] = 2" right?

So probably instead of comma to seperate the criteria u need to use the
above construct
 

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

Back
Top