From: trevorC via AccessMonster.com on
Hi,
Can I have 2 subforms linked in some way that if the user changes the
selection of one the other follows and displays the same record (different
information).

Currently I have one subform that is listing employee names, a linked photo
and an employed by logo. The other list will show any special status for the
employee (First aid officer).

--
Message posted via http://www.accessmonster.com

From: Crystal (strive4peace) on
Hi Trevor,

assume the primary key (PK) for your table is a field called
EmpID

in the LinkParentFields for the second subform --> EmpID

WHERE

EmpID is a texbox control on the unbound main form with this
ControlSource -->
=subform1_controlname.form.EmpID

the current event of subform #1 does this:
'~~~~~~~~~~~
me.parent.EmpID.requery
'~~~~~~~~~~~


Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access
(also has links to chapters for learning VBA, sample
databases, and Whistles and Bells)

*
(: have an awesome day :)
*


trevorC via AccessMonster.com wrote:
> Hi,
> Can I have 2 subforms linked in some way that if the user changes the
> selection of one the other follows and displays the same record (different
> information).
>
> Currently I have one subform that is listing employee names, a linked photo
> and an employed by logo. The other list will show any special status for the
> employee (First aid officer).
>
From: trevorC via AccessMonster.com on
Thanks for the reply Crystal,
the solution you offered will filter the list down to only showing the
selected record, there may be several that need to be listed.

below is what i have so far...
Main form
main menu - unbound

Sub form - datasheet view
employees at work - lists all employees at work using check box from
employees table that is updated when they log in.
forms![main menu]![employees at work].Requery after login.

Sub form - datasheet view
special employees - shows a list of employees with special tasks (fire warden,
first aid officer). this sub form is filtered to only show employees at work
and with special tasks

below is the code i have for this sub form, if I use the mouse to select a
different record the employees at work sub form follows the special employees
sub form and displays the correct record

IF on the other hand i use the arrow keys to select a different record i get
a debug error that stops at the line DoCmd.FindRecord Listed_employee,
acEntire, False, , False, acAll, True

error message returned is - There is no field named 'ID' in the current
record.
I can only asume that this is caused by the action of selecting the record
with the kayboard changing the focus.
I am confused as to why this is different. ( I am using keypreview to stop
Alt & Ctl commands) maybe this is cauing it.

Private Sub Form_Current()
Listed_employee = Forms![main menu]![special employees]![Employee]
DoCmd.GoToControl "[employees at work]"
DoCmd.GoToControl "[ID]"
DoCmd.FindRecord Listed_employee, acEntire, False, , False, acAll, True
End Sub

--
Message posted via http://www.accessmonster.com