Stepping through a table

M

Mac@440th

I have a form (for these purposes, let's call it Form A) that is based
on a query with 38 rows of information, each row containing 7 fields.

I have a second form (Form B) with the same primary key as the table on
Form A. If the user clicks on a button on Form B, I would like Form A
to open (which it does), have a primary key on Form B passed to Form A
(which it does) and on Form A I want to step through the entire table
until I find the same primary key. I then want that row to be
highlighted in another color.

Is this do-able via a Do...Loop statement or some other method?

Thanks in advance for any assistance.
 
K

KARL DEWEY

Why not use a main form/subform using the primary key as Master/Child link?

No stepping required at all - bing, it is there.
 
V

Van T. Dinh

From your description, I guess FormA is in ContinuousFormView?

If that's the case:

* You can pass the ID from FormA to FormB using the OpenArgs argument of the
OpenForm method.

* In the Load Event of FormA, use RecordsetClone to find the Record/row that
has the ID passed through via the OpenArgs and set the this row as the
current row/Record for the Form.

Check Access VB(A) on RecordsetClone. The code in the last example is very
close to what you need.

* For highlighting the current row/Record, see Stephen Lebans' Web site:

http://www.lebans.com/conditionalformatting.htm
 
Top