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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wildcard for a Currency Field 2

Status
Not open for further replies.

joeconway

Technical User
Feb 19, 2007
4
GB
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

thanks

 
I'm not sure I understand the question.

Do you mean the postfix type-declaration character? In which case you want @.
 
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 = "*"

I tried using "@" but it didnt work
 
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
 
Convert it to a text string and then use the wildcard:

For the JET OLEDB with ADODB you would use:

WHERE STR(MyCurrencyField) LIKE "' 1.%'"

Be sure to leave the leading space, prior to the amount, or use "'_1.%'"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top