K
Kenny A.
I am working with Access 2003 SP3. I have a mainform (POLLTROUBLE) with a
subform (PTSUBFORM1). The subform is linked to the mainform by Link Child
Fields and Link Master Fields = pollid. I have a query (qrysf1PT) that
returns a result set for the subform. The subform displays 4 columns (POLLID,
POLLTROUBLE, TDAT, and ACTION). As I move through the records in the
mainform, the associated records (multiple) in the subform are displayed (as
expected) The records in the subform are listed in descending order based on
TDAT (date field). What I am trying to do is, retrieve the value in the
column POLLTROUBLE of the first record listed for the associated record in
the mainform, and pass this to another table via VBA code. I am using the
DLookup function, but I do not seem to be retrieving the proper value of the
associated record. This is the code I am using: mytable("PollTrouble") =
DLookup("POLLTROUBLE", "qrysf1PT", POLLID). Mytable is defined in earlier
code. When I am stepping through the code, POLLID has the proper value, but
the associated value of POLLTROUBLE is not correct. It has a different
value, and I do not know which record it is actually looking at when it pulls
this wrong value. What am I doing wrong? Please help point me in the right
direction.
Thank you in advance
Kenny
subform (PTSUBFORM1). The subform is linked to the mainform by Link Child
Fields and Link Master Fields = pollid. I have a query (qrysf1PT) that
returns a result set for the subform. The subform displays 4 columns (POLLID,
POLLTROUBLE, TDAT, and ACTION). As I move through the records in the
mainform, the associated records (multiple) in the subform are displayed (as
expected) The records in the subform are listed in descending order based on
TDAT (date field). What I am trying to do is, retrieve the value in the
column POLLTROUBLE of the first record listed for the associated record in
the mainform, and pass this to another table via VBA code. I am using the
DLookup function, but I do not seem to be retrieving the proper value of the
associated record. This is the code I am using: mytable("PollTrouble") =
DLookup("POLLTROUBLE", "qrysf1PT", POLLID). Mytable is defined in earlier
code. When I am stepping through the code, POLLID has the proper value, but
the associated value of POLLTROUBLE is not correct. It has a different
value, and I do not know which record it is actually looking at when it pulls
this wrong value. What am I doing wrong? Please help point me in the right
direction.
Thank you in advance
Kenny