Find or filter a Record in Main Form from Subform

A

Andi Lee Davis

Hi,

Any Help most Gratefully Appreciated.

I have looked up the forms but nothing seems to really answer my question
just right and its very simple.

I have a Database which plots stories and plays into sections. I have a form
which is labelled SectionSheet which also has continuous subform named
SectionSheetMap. This Map is based on a query from the Main Table
SectionSheet.
The subform filters the list of all the sections to those with the main
character on the main form as a sort of overview. You can see which section
sheet is the characters next and pre section. So the Form and Subform are
linked by the section Character - Not the SectionNo which is the Primary Key.

What I would like to do is two things.

1) Highlight the font or make it bold on The SectionNo field in the Subform
and move to the recordset along the continuous form to match the record you
are on in the main form. - Haven't started working on this yet.

2) This is the bit I have been working on. On Double Click of a SectionNo of
the subform - Jump to that section in the main form. I have got so far and
managed to get the focus back to the SectionNo in the main form but it keeps
filtering the Subform to match the SectionNo in the Main form.

Here is the code I have already: (I used a filter to try it first)

Private Sub SectionNo_DblClick(Cancel As Integer)

Dim MapNo As String

MapNo = Form_SectionSheetMap.SectionNo

On Error GoTo clickError

Me.Filter = " [Forms]![SectionSheet]![SectionNo] like " & MapNo & ""
Forms!SectionSheet!SectionNo.SetFocus
Me.FilterOn = True

clickError:

Resume Next


End Sub


Thanks

Andi
 
A

Andi Lee Davis

Ok so I solved it now with this...

Private Sub SectionNo_DblClick(Cancel As Integer)
Dim MapNo As String
MapNo = Form_SectionSheetMap.SectionNo
On Error GoTo clickError
Forms!SectionSheet!SectionNo.SetFocus
DoCmd.GoToRecord acActiveDataObject, , acFirst, no
DoCmd.FindRecord MapNo, acEntire, no, acSearchAll, no, acCurrent, no

clickError:
Resume Next

End Sub

This works a treat for wanting to jump to the record in the main form from a
subform.

All I need to know how to do now is point 2.

Move the current record in the subform (Continuous form) along with the
main form so that it scrolls along keeping the record in the subform in view.
I do not want it fixed to the main form (IE you can still scroll up and down
independantly using the scroll bar) Also highlighting on making the font in
the PK show so you see the matching reocrds quickly.

Any help appreciated.

Thanks

Andi
 

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