Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data type mismatch 1

Status
Not open for further replies.

dugen

Programmer
Jun 16, 2003
59
US
sSql = "Rent_Price Between '" & Me.txtRentPriceMin.Value & "'AND '" & Me.txtRentPriceMax.Value & "';"

I get a datatype mismatch error when i run this query.

at the end of the code I have:

sSql = "Select * from Listing where " & sSql

In my table i have the field set as double and i am putting numbers into the text boxes.

Any ideas?
 
Dugen,

Your first sSQL definition does not have a SELECT element to it, is this an SQL query or does the data come from another source i.e. data on a form?

Leigh Moore
LJM Analysis Ltd
 
Its a form that searches a database and finds specific records. The two text boxes on a form where the user is to put in a price range (ex:50000 to 100000).

The first sSql does not need a select statement because the second sSql statement already has it. The first statement is building on to the second.
 
Your problem is that you have your 2 form values wrapped with single quotes ( ' ). this denotes a String, not a double.

Your code should be;

sSql = "Rent_Price Between " & Me.txtRentPriceMin.Value & " AND " & Me.txtRentPriceMax.Value & ";"

Hope this helps.


Leigh Moore
LJM Analysis Ltd
 
Yea that does it.

Thank you for the help!!
 
think a star for leighmoore is in order dugen. This is the standard way of "rewarding" helpful / expert answers. It also helpd those users who search the archives to "seek out" those threads with the stars :)

Rgds, Geoff
Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?
Want the best answers to your questions ? faq222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top