Last week I posted regarding synchronizing two different forms. I have 2
main forms with subforms. Form 1 is a doc form with pt listed in a subform.
Form 2 is a pt form with docs listed on the subform. I would like to have
the ability to place my cursor on the doc form's subform for a specific pt.
On a double click have the Pt form open to that specific pt. I tried the
following, in the Doc subform. however, it opens the pt form but with no
data. My PK is PT ID consisting of three letters and 4 number (AAA1234)
Sub Form_DblClick(Cancel As Integer)
DoCmd.Openform "PTForm",,,"PtID =" & Me.Docptlistsubform.txtPTID
End Sub
I also tried: DoCmd.Openform "PTFORM",,,"PTID=" & Me.txtPT
Nothing!! Do I need to enter some event code on the PTFORM as well?
I have tried different things. Sometimes I get a blank PTFORM or an error
message saying can't find the field PTID referenced in your expression.
Can someone please help me get this right. Thank you in advance for your
help.
If the code you are using is placed in the sub form, then use
DoCmd.Openform "PTFORM",,,"PTID=" & Me.txtPT
======================================
If the txtPT field type is text, then you need to add a single quote to the
value
DoCmd.Openform "PTFORM",,,"PTID='" & Me.txtPT & "'"
======================================
If you are trying to open the form from the main form then use
DoCmd.Openform "PTFORM",,,"PTID=" & Me.[SubFormControlName].From![txtPT]
======================================
Now, for the main question.
If you want to filter the data that is placed in the sub form of the second
form, all of the above won't work, it will filter only the data on the main
form.
If that the case, please post back and I'll give another way of filtering
the data in the sub form

Signature
Good Luck
BS"D
> Last week I posted regarding synchronizing two different forms. I have 2
> main forms with subforms. Form 1 is a doc form with pt listed in a subform.
[quoted text clipped - 17 lines]
> Can someone please help me get this right. Thank you in advance for your
> help.
TotallyConfused - 29 Jul 2007 18:36 GMT
Thank you for responding. The code that I mentioned below is in Form1 (doc
form) with a sub form of pt's list. I used your first example and I get the
following message "compile error method or data member not found"
Since my txtpt is text I used your second example - I got the same message
as above.
On my Form 1 (Main doc form) there is the subform below of Pts I want to
double click on a patient and then have Form 2 PTFORM open to that specific
pt. I do not want to filter the Patient's subform. Just want the PTFORM to
open to specific patient from Form 1 subform list. I am sure that this can
be accomplished but somehow something minor is missing. I appreciate any
help. Thank you so much
> If the code you are using is placed in the sub form, then use
>
[quoted text clipped - 38 lines]
> > Can someone please help me get this right. Thank you in advance for your
> > help.
Ofer Cohen - 30 Jul 2007 11:18 GMT
Openning form 2 when the double click is on the sub form of form1, this
should work
DoCmd.Openform "PTFORM",,,"PTID='" & Me.[txtPT] & "'"
Just to make sure that this field is found, open the Immidiate window (press
Ctrl+G) and type
?Forms[Main doc form]![SubFormControlName].Form![txtPT]
Press Enter and see which value returned
Note: Make sure that the main form and the control of the sub form names are
correct.

Signature
Good Luck
BS"D
> Thank you for responding. The code that I mentioned below is in Form1 (doc
> form) with a sub form of pt's list. I used your first example and I get the
[quoted text clipped - 52 lines]
> > > Can someone please help me get this right. Thank you in advance for your
> > > help.