Looking up a related record in a related form

J

Jim Normile

I have a “Clients†table with about 1000 records. Each record has an
autonumber ID which is also the primary key. I have built a simple “Clientsâ€
form on the table for normal viewing and updating. Call this form “Form Aâ€

I have a second “Transactions†table which records specific transactions
with the clients in the first table. Each transaction has an autonumber
ID/Primary key. In addition it has a lookup field which looks up the ID of
the Client from the “Client†Table, and creates a relationship with the
Client Table.

I have a Query which includes both of the above related tables, showing
required information from the “Client†Side and from the “Transaction sideâ€.
On top of this query I have built a second form, which allows me to
view/update individual client and transaction details. Call this form “Form B.

When I look at Client records in Form A, I can see if there are associated
records in the Transaction table, through a small subform. I need to be able
to click a button on form A which will open Form B, and take me to the
related transaction record on Form B.

Using the form wizard I can easily open Form B, but I have not been able to
automatically go to the correct linked record in form B. I expect I need to
write a piece of VBA code for the “On Click†event on the button on form A,
but I haven’t managed to write the correct code.

Can anybody out there advise me:
(1) Is VBA code attached to the “On-Click†event on the button on form A the
correct approach??........IF not, what is the correct approach??
(2) Can you help me with the code please ??

My thanks in anticipation


Jim Dublin
03 November 2004
 
Top