Hey. I'm in Manila (the Philippines) for 6 months (3 are almost done) trying to make a database for the first time ever (kind of a surprise project for me). This is included as a disclaimer as to why it may sound like I'm using terrible technique or what not... I'm using MS Access 2002.
What I need is synchronization between different subforms on the same tabbed control. I figure that a filter is the best way to do it, but I'm having serious problems. I'll give a scenario:
My tabbed control is called [CPR Main]
The subform on one tab has the caption [CPR Event Profile]
The subform on another tab has the caption [CPR Group Profile]
Both subforms have a control called [EventNo], which I would like to use for filtering.
SO, I found a piece of a program in the help files that looks like it might work in my situation, and I put the following code in the OnCurrent event of the [CPR Event Profile] subform:
[Forms]![CPR Main]![CPR Group Profile].FilterOn = True
[Forms]![CPR Main]![CPR Group Profile].Filter = "EventNo = [Forms]![CPR Main]![CPR Event Profile]![EventNo]"
What I assumes this does is, when the focus changes between records on the [CPR Event Profile] subform, the filter should be applied (based on the value of EventNo). HOWEVER, what happens instead is I get the error
"Object does not support this property or method"
pointing at the first line of code... so a subform can't have filters??? But, when I go to the subform in design view, I can find a filter property, so I'm really confused. Any ideas?
There is a very easy way to synchronise subforms, but it is not obvious.
This avoids filters and requires no code to perform the synchronisation.
I will try to explain it, it is a little tricky. Go to design view of your form containing the subform. Select a subform and select to find the parent, child link, choose any link you like at this point. Go back to Property view.
Set up an unbound text box, call it txtLink or something. Change the parent link to the name of the textbox e.g. txtLink. Do not try and do this in the wizard as it wont work. Now make txtLink's value your link value and make it invisible.
That's it very little code, very little work and reliable.