NoMatch never matching

  • Thread starter Thread starter ged
  • Start date Start date
G

ged

haha I found this a major drama but found the problem maybe someone
could tell me the reasoning behind the fault

Set db = CurrentDb()
Dim rs1 As dao.Recordset
Set rs1 = db.OpenRecordset("ListZones", dbOpenSnapshot)
rs1.FindFirst "ZoneName =" & """ & TheZoneName & """
If rs1.NoMatch Then

No matter what was passed or what i did it wouldnt say matched

Now i firstly tried everything to do with the data and all the dao
crap different calls of the recordset to no avail but the answer is in
there stupid but hell its there

Some one else see it? (Ive fixed it but just wanna see who will get
stumped from it)
 
In
ged said:
haha I found this a major drama but found the problem maybe someone
could tell me the reasoning behind the fault

Set db = CurrentDb()
Dim rs1 As dao.Recordset
Set rs1 = db.OpenRecordset("ListZones", dbOpenSnapshot)
rs1.FindFirst "ZoneName =" & """ & TheZoneName & """
If rs1.NoMatch Then

No matter what was passed or what i did it wouldnt say matched

Now i firstly tried everything to do with the data and all the dao
crap different calls of the recordset to no avail but the answer is in
there stupid but hell its there

Some one else see it? (Ive fixed it but just wanna see who will get
stumped from it)

You've got the wrong number of quotes to specify a quote in a quote.
You need either this:

rs1.FindFirst "ZoneName =" & """" & TheZoneName & """"

or (simpler) this:

rs1.FindFirst "ZoneName =""" & TheZoneName & """"

or (easier to read) this:

rs1.FindFirst "ZoneName =" & Chr(34) & TheZoneName & Chr(34)

or (easier yet) this:

Const Q As String = """"

rs1.FindFirst "ZoneName =" & Q & TheZoneName & Q
 
In








You've got the wrong number of quotes to specify a quote in a quote.
You need either this:

rs1.FindFirst "ZoneName =" & """" & TheZoneName & """"

or (simpler) this:

rs1.FindFirst "ZoneName =""" & TheZoneName & """"

or (easier to read) this:

rs1.FindFirst "ZoneName =" & Chr(34) & TheZoneName & Chr(34)

or (easier yet) this:

Const Q As String = """"

rs1.FindFirst "ZoneName =" & Q & TheZoneName & Q

Yeh to a better trained eye you have it in one for some reason it took
me a bit of testing with this that and everything about the DAO but in
the end i deleted it and rewrote the area and walla it came good

Thanks for the chr(34) one that is way easier

These posts where done in case another NOOB like me get stuck on the
same thing !!

ps I hope a few of yous got stuck on it as well
 
Back
Top