Toggling between two sets of forms/subforms

F

Fred Mart

I have a database that deals with Employees and Jobs.
There are two main forms - one is an Employee view and
the other is a Position (or Job) view.

There is a many-to-one relationship of Employees to Jobs
and, conversely, Jobs to Employees. I thus have a
linking table called Actions (Interview, Offer, Accept,
etc.) which defines the relationship between an Employee
and a Job. The single Employee view form has a subform
datasheet that shows limited information (Positions,
Actions and Action dates) that the Employee is associated
with.

In a similar vein, the Position view form has a subform
showing info about the Employees and Actions that the
Position is associated with.

My problem is this - I want to place a command button in
the footer of the Employee view form that when selected
takes me to the detailed Position view of the selected
Position in the subform. I also want to do the same from
the Postion view form - i.e. go to the Employee view form
from the selected Employee record in the subform.

I've spend a couple of days trying to get the button
coded but to no avail. So - help!

Fred M3
 
P

Perry

Fred Mart said:
I have a database that deals with Employees and Jobs.
There are two main forms - one is an Employee view and
the other is a Position (or Job) view.

There is a many-to-one relationship of Employees to Jobs
and, conversely, Jobs to Employees. I thus have a
linking table called Actions (Interview, Offer, Accept,
etc.) which defines the relationship between an Employee
and a Job. The single Employee view form has a subform
datasheet that shows limited information (Positions,
Actions and Action dates) that the Employee is associated
with.

In a similar vein, the Position view form has a subform
showing info about the Employees and Actions that the
Position is associated with.

My problem is this - I want to place a command button in
the footer of the Employee view form that when selected
takes me to the detailed Position view of the selected
Position in the subform. I also want to do the same from
the Postion view form - i.e. go to the Employee view form
from the selected Employee record in the subform.

I've spend a couple of days trying to get the button
coded but to no avail. So - help!

Fred M3
 
P

Perry

Several.

If the LinkMasterFields/LinkChildFields properties of the subforms
are correctly setup little code (or none at all) will be needed.

You can also change the recordsource of the subform to
respond to the selected item on yr mainform
VBA code from the main form button:
Me.subPosition.Form.RecordSource = _
"select * from tblPosition where PositionID =" & Me.PositionID

Krgrds,
Perry
 

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