This really is a case of me being stupid but I don't know and really cannot find anywhere what Wildcard to use for a currency field, nothing seems to be working:S
I mean that i have a search form for entering the variables for querying a database and for the price field i have this code which keeps giving a type mismatch:
txtprice.SetFocus
If txtprice.Text = "" then txtprice.Text = "*"
Currency is a numeric data type, thus you can't give it a value of "*".
And if you're searching against a number, you wouldn't be using an SQL "LIKE" operator, you would be using "equal to" (=), "greater than" (>), or "less than" (<).
I guess you're constructing a SQL query string dynamically. If that's the case then test for the txtPrice.Text value being empty and set your WHERE clause to suit
Code:
strSQL = "Select myField from myTable"
If Val(txtPrice.Text) > 0 Then
strSQL = strSQL & " Where myPrice = " & Val(txtPrice.Text)
End If
' use the strSQL for your query
You may need to clarify your requirements if that doesn't answer it for you
It's also worth reading faq222-2244 to see how to get the best from these forums
___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?' Drive a Steam Roller Steam Engine Prints
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.