Move to record in Parent form

D

daz

Hi
I have a sub-sub-form (sub2) and this has a combo to select any item in
this table (all items in tblsub2 and not just those related to sub1,
which is in turn related to main)

I can't seem to find a way of making the parent forms (main and sub1)
go to their corresponding entries, based on the sub2 selection.


Does that even make sense?
Hope to hear from someone soon.
Daz
 
D

daz

Sorry
The combo in sub2 includes (but hides) the IDs of the related records
in sub1 and main.

Ta.
Darren
 
M

Marshall Barton

I have a sub-sub-form (sub2) and this has a combo to select any item in
this table (all items in tblsub2 and not just those related to sub1,
which is in turn related to main)

I can't seem to find a way of making the parent forms (main and sub1)
go to their corresponding entries, based on the sub2 selection.


Does that even make sense?


I'm not sure it does make sense, but I think I understand
what you're trying to do. Normally(?) the record selection
combo box is place in the main report's header section, not
in another form or subform.

Whatever. This can be done in essentially the same way
regardless of where the combo box resides. Assuming that
the combo box's bound column corresponds to the main ID
field, use code like this in the combob box's AfterUpdate
event procedure:

If Not IsNull(Me.combobox) Then
With Forms!mainform.RecordsetClone
If .RecordCount > 0 Then
.FindFirst "mainIDfield = " & Me.combobox
If Not .NoMatch Then
Forms!mainform.Bookmark = .Bookmark
End If
End If
End With
End If
 
D

Daz

You said:
If Not IsNull(Me.combobox) Then
With Forms!mainform.RecordsetClone
If .RecordCount > 0 Then
.FindFirst "mainIDfield = " & Me.combobox
If Not .NoMatch Then
Forms!mainform.Bookmark = .Bookmark
End If
End If
End With
End If


Great, thanks.
I modified the code to refer to a hidden column in the combo
Me.combobox.Column(3)
I also used similar code to ensure sub1 reflected the change.

I had to use Me.Parent.Parent.RecordsetClone (and
Me.Parent.RecordsetClone) to get it to work...maybe I missed something
beforehand.

Anyway...thanks for your help. All sorted now.
Dazza
 

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