Stepping through a table

  • Thread starter Thread starter Mac@440th
  • Start date Start date
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.
 
Why not use a main form/subform using the primary key as Master/Child link?

No stepping required at all - bing, it is there.
 
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
 

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

Back
Top