Opening Specific Subform within a Form

D

Drew

-----Original Message-----
I have a DB with two linked tables (Demographics and
Claims) linked via SSN (one to many). I have a form that
lists open claims via SSN and Claim ID. I want to have a
Find button open the Demographic and display a specific
claim for that demographic. Here is the code from my Find
button:
----------------------------------------
Private Sub FIND_Click()
On Error GoTo Err_FIND_Click

Dim stDocName As String
Dim stLinkCriteria As String
Dim stSubL

stDocName = "Averts"
stLinkCriteria = "[ssn]=" & "'" & [Forms]![Follow Up
List Form]![ssn] & "'"

DoCmd.OpenForm stDocName, , , stLinkCriteria,
acFormEdit, acWindowNormal

With Forms.Averts.Claims.Form.RecordsetClone
.findfirst "[Claimid]=" & "'" & [Forms]![Follow Up
List Form]![Claim ID] & "'"
If Not .nomatch Then
Forms!Averts.Claims.Form.Bookmark = .Bookmark
End If
End With

Exit_FIND_Click:
Exit Sub

Err_FIND_Click:
MsgBox Err.Description
Resume Exit_FIND_Click

End Sub----------------------------------------
What I need it to do is open the Main form (Averts) and
open the specific SSN listed on my search form. Then I
need it to open the specific Claim on the Subform (Claims)
that is listed on the search form (Follow Up List Form).

Please help!

THX!
.

Open Main Form with SSN on Search Form
Dim OpArgSSN as string 'if not a String'
Use Open Args
OpnArgSSN = CStr(me.SSNControlName)
Docmd.OpenForm "FormName" ,,,,, OpnArgSSN

In the Form you are opening, in the ON OPEN event, set
the field holding the SSN equal to the Open Args sent via
the other form

Me.SSNControlName = Me.OpenAgrs


Make a query on the newly opened form to Query by Form
and have the parameter point to the other form. IF you
wish to not have the other form visisble, when lauching
the new form, have the calling form make itself
Visible=False

Me.visible = False

You can put this before the DoCmd. line opening up your
new form. Remember to open the form up in the Dialog
mode if you wish to have them work only on that form and
mandate that they close that form before returning the
the calling form.

If you then want to see the calling form, after the Docmd
call put

Me.visible = True

When opening another form in the Dialog mode stop the
code in the calling form until the other form is closed.

Drew
 

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