Doing it by getting the main form to jump to the record shown in the
subform
is tricky.
Allen has some code here to filter a form by a value in a subform.
http://www.allenbrowne.com//ser-28.html
If I wanted to edit an item chosen in a subform, I would open another
form
to allow edits of the selected record and hide the main form and
subform
until the edit was saved in the opened edit form.
Then in the unload event of that opened edit form I would requery the
hidden
main form and subform.
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
Hi Jeanette,
Thanks for your reply, but I am using a subform to list out
workstations
(ie
continuous forms) as there is other data displayed with each
workstation
and
this data is colured (red + green). The idea being that you scroll
down
this
list and can action items that appear in red, so a combo box is not
ideal
for
this. To action an item, you select the workstation and then the
mainform
jumps to that workstation.
Going by this code from Allen Brownes website I tried this:
Sub Form_Click()
Dim rs As DAO.Recordset
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[RecID] = " & Me.RecID
If rs.NoMatch Then
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Forms![Get all Details].setfocus
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End Sub
-------------------------------------------
But the above does not work ... any ideas?
:
Usually, in access, we do this by putting a dropdown in the header
of the
main form.
The dropdown (unbound), contains the list of workstations.
User selects a workstation from the dropdown and code in the after
update
event for the dropdown moves the main form to that workstation.
The subform is automatically filtered to that workstation through
the
link
master and link child fields.
Sample code for the after update of the combo can be found here
http://www.allenbrowne.com//ser-03.html
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
Hi,
I have a main form with a sub form and the two are linked by Child
and
Master fields. The main form has a list of workstations, and the
sub
form
has a history of errors that have occurred on that workstation.
So,
when
you
select a particular workstation, the related errors show up in the
related
sub form - all works good.
Now, I want to add a new sub form which contains a vertical list
of
workstations. The idea being that when you select a workstation
from
the
new
(unlinked sub form), the main form and its linked sub form display
that
workstation.
Can anyone advise how to achieve this?
Cheers,
GLT.
.
.