FindFirstThanks for your time and help.
From: Pavan Desai
Email: pdesai@orbit.hr.att.com
dsLookup.FindFirst "UserName Like """ & txtName.Text & "*"""
A couple of notes:
I hope that explains what you need to do to get your search happening. Enjoy.
When I asked for your help, I had the following code for queries:
Set Rst = Db.OpenRecordset("Select * FROM Titles WHERE Title = '" & Text1.Text & "'", dbOpenSnapshot)
While this is adequate, it cannot resolve the apostrophes as in O'Reilly, and as you mentioned, using the two double quotes in Findfirst certainly solved that problem!!
Again, thanks so much for your help and time.
P.S. - Is there anyway to use the above SQL query to resolve the apostrophes also??
From: Pavan Desai
Email: pdesai@orbit.hr.att.com
Set Rst = Db.OpenRecordset("SELECT * FROM Titles WHERE Title = """ & Text1.Text & """", dbOpenSnapshot)
As you can see (if you look closely) I have just replaced your use of an apostrophe with two double quotes. It's really that simple. You can use the same technique anywhere, it's just part of the way VB resolves string literals.
I'm glad my previous answer helped you out. It's the precise and well described questions that are easiest to answer. Remember, enjoy your database.
day/month/year
When I use this:
dim data as date
Set db =3D OpenDatabase(App.Path & "\programa.mdb")
Set rst =3D db.OpenRecordset("PROGRAMA=C7=C3O", dbOpenDynaset)
data =3D "7/1/96"
rst.findfirst "data =3D#"& data & "#"
....I have a no match answer.
But if I look for a date, that has two digits for days, it works:
data =3D "17/1/96" rst.findfirst "data =3D#"& data & "#"
...then I have a found OK.
I tried all the possibilities, but there's always the same answer. When I use one digit (7)/1/96 doesn't work; when I use two digit (17)/1/96 it works. I wonder if you could help me?
Thank you,
From: Ricardo
Email: rhprod@netalpha.com.br
What this means is that if it can resolve your date to m/d/y it will do so. If the first number is obviously a day however (being more than 12), it figures out that it is a day and responds appropriately.
The best thing I can recommend is that you always pass dates to JET using m/d/y format. I know it's a pain but it will always work without relying on JET to decide what is going on.