I need a nap!
Set rst = CurrentDB.OpenRecordset(strSQL)
:
Klatuu,
thats ok, my brain is ready for the weekend too,
that fixed this error but heres another for you,

Compile error: Method or data member not found for the .rst =
in Set CurrentDb.rst =
-James
:
ARGGH!
Is my typing bad today or what. I think my brain has already left for the
weekend. I apologize to you for not getting it right sooner. Put a period
between CurrentDB and OpenRecordset:
CurrentDb.OpenRecordSet(strSQL)
:
same error, sorry this is taking so long
James
:
CurrentDbOpenRecordSet(strSQL)
:
Klatuu,
Now that is working, but i get a Compile error: Sub or Function not defined,
for dbOpenRecordSet(strSQL)
-James
:
Sorry James, you were correct
& "WHERE fld1 = '" & strPet & "' Or fld2 = '" & strPet & "' Or fld3 = '" &
"'strPet';"
:
Klatuu,
I'm still having the same problem i think it may have something to do with
the last quote i cant find an open quote for that one in the line
:
This should be all on one line, it just wraps text in this posting
& "WHERE fld1 = '" & strPet & "' Or fld2 = '" & strPet & "' Or fld3 = '" &
strPet;"
:
Klatuu,
When I copied this code into VB it gave me an error expected end of
statement at the ; after strPet
-James
:
Well, maybe a parameter query is not the way to go, a good ol' SQL statement
would be better:
Dim rst As Recordset
dim strSQL as String
dim strPet as String
strPet = "Cat"
strSQL = "SELECT * FROM mytablename " _
& "WHERE fld1 = '" & strPet & "' Or fld2 = '" & strPet & "' Or fld3 = '"
& strPet;"
Set Currentdb.rst = dbOpenRecordSet(srtSQL)
If rst.Recordcount = 0 Then
'No Matches
Else
rst.MoveLast
rst.MoveFirst
End If
:
Klatuu,
I've been all over both help files and either don't understand what they are
telling me or it doesn't do what i want it to, are there any suggestions on
how to use Parameter Queries?
-James
:
Then you will have to use Parameter Queries. Best bet is to look up
Parameters int Access Help.
:
I was using VB coding for more simple searches, using
stLinkCriteria = "FIRCOM = '" & Me!FIRCOM.Value & "'"
DoCmd.OpenForm "tblFirings Query", , , stLinkCriteria
is there any way to do it like this, I haven't done much with access so i
dont know if this is a query or not, by the way i am trying to create a
search form so it can be used multiple times without changing the code but
still being able to change the search criteria, so puting cat or 145 lbs
won't work.
:
How are you doing the search? If you are using a query, then to look for Cat
in three fields, you would have to have in your Where criteria:
[Field1] = "Cat" Or [Field2] = "Cat" Or [Field3] = "Cat"
To find people between 145 and 155 pounds:
[WeightField] >= 145 And [WeightField] <= 155
:
Hi
Im trying to make a couple of advanced search options for my database using
coding and forms,
I have two questions
1) How do I make a search that will look for a range of numbers, for
example if I want to find people who weigh 150 lbs in my database and I want
the database to show all of the forms for people who way between 145 and 155
lbs?
2) How do I make a search that will use the same criteria to search
multiple fields and bring up all matchs? For example, if I have three fields
for Pet type and I want to search each field for cat and have the database
show me every match that has cat in at least one of the fields.
I have been working on this for days and finally broke down and decided to
ask, any help would be great.
thanks,
James