Finding record with code

M

Melissa Thomatz

I have incorporated the Seek method with VBA to find a
record with three conditions. Although I know the record
exists, the Seek method won't work with the "=" sign,
instead I have to use either ">=" or "<=" and then it
doesn't always grab the right record. I've included the
code below. Thanks in advance for any help you can give.

Melissa Thomatz



Code sample:
"DoCmd.SelectObject acForm, "EditTubeHours"
str1 = [Forms]![EditTubeHours]![DIRECTION]

str2 = [Forms]![EditTubeHours]![DATE]

str3 = DateAdd("h", 1, [Forms]![EditTubeHours]!
[TIME])

str4 = [Forms]![EditTubeHours]![LANE]
intSite = [Forms]![EditTubeHours]![SITE]

With rst2

.Seek "<=", intSite, str4, str1, str3

If rst2.NoMatch = False Then
total = ![total]
BIKE = ![BIKE]
CAR = ![CAR]
PICKUP = ![PICKUP]
BUSHTWT = ![BUS&HTWT]
f2axsu = ![2axsu]" (not the end)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top