Can I do a lookup??

B

Bob Howard

I'm not particularly adept with DAO, so this has been a stretch...

I'm trying to loop thru each record in a particular table to set the
contents of a field (let's call it Field A and which is currently unused) to
a set of values based on certain conditions. This field is a boolean.

The records also contain a FieldB, which is a string and which can contain
only three values (H, O or I).

The records also contain a FieldC, which is a "long". The records in the
table are "grouped" in that all records containing the same value in FieldC
are associated with one another.

A particular group will contain either one "H" record or one "O" record.
The rest of that same group will consist of zero or more "I" records.

The logic to determine whether to set it true or false is roughly as
follows:

If FieldB equals "H" or "O", then I want to set FieldA (the previously
unused field) to true.

This part is working.

Here's the part that I can't figure out...

If FieldB equals "I" (the only other valid value in this application), then
I need to see if that record is associated with an "H" record or an "O"
record.

I've tried using DCount and DLookup with no success because the program I'm
running is part of a front-end and the database I'm "converting" is a
backend somewhere --- and I have no link to the backend (I just get to is
via DAO).

Is there something in DAO similar to the DCount or DLookup? I don't really
need to see the associated record(s) --- just whether there's an "H" or "O"
associated with my record.

Does any of this make sense?? Or am I making it more complicated than
necesssary??

bob
 
B

Bob Howard

I got it figured out...

I needed to bookmark the current record location and then do a movefirst to
try and find a matching record. After checking for nomatch, I then used the
bookmark to return to the prior location. And to make all this work, I has
to specify dynaset in the openrecordset.

Many attempts --- but it finally worked!

thanks for your patience with this dunderhead!

bob
 

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