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

NOT A VALID BOOKMARK ???

Status
Not open for further replies.

ooops

MIS
Dec 21, 2000
91
US
Hi all,
this is my connection:
cnResident.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = d:\myDatabase.mdb")

and this is my query:
sQuery = "SELECT * FROM tableName WHERE Location_No >'7047'"
rsResident.Open sQuery, cnResident

It works fine most of the time but if i change the operator to < (smaller than) instead of > (larger than) then i got the error msg:
runtime error '-2147467259(80004005)':
Not a valid bookmark.

How does this happen ? and what does it mean ? It's just practically the exact same, why one works and the other doesn't ? I'm extremely desperately here, please help me get it solved. Million thanks to you.
Helen Sincerely,
Bao Nghi
 
Have u noticed that u r working with strings (I mean characters) u can say larger than and smaller that but it is not the same as Numbers. Location_No sounds like &quot;Location Number&quot; if the hole column is numeric why don't u pass ur a parameter as Numeric. But if ur column is a string let me tell u that u have a design prob.
I hope this help.
 
I am sorry. I read my own answer and I coudn't understand it very well.

What I ment is:

x = 10
y = 2
is x > y
(this r numeric)
But
x = '10'
y = '2'

is x > y
(this r characters)
In the second one u can also have letters if u want and ask the same
x= 'a'
y = '24s'
is x > y

You will never recieve a reall answer from a question like that.
I do recommend u to look for a way to covert all those values to numeric To do it in the right way.

I hope this is much clear
 
Hi,

Thank you very much for all your help. You're right it's not a good way to do it. But the thing is this. I have a drop down list for all the fieldname (many fields are number type and others are text) and a another drop down list for operators and a textbox for user to type in the value they want to search. It's likely that the user won't use </> to query text fields but in case they accidently do, i believe it should not be a problem. And since in Access we can query text/date fields with </> just fine, i wonder why it goes wrong in my VB application. If you have any idea how to fix it, please let me know. I really appreciate your time and your help.
Helen Sincerely,
Bao Nghi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top