Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform to form.

Status
Not open for further replies.

lars7

Technical User
Aug 16, 2005
817
GB
Hi,
I am trying to get a subform to be selected with the values in 2 text boxes on the main form but with no luck . I am trying the following code:

Dim frm As Form
If Not Me.NewRecord Then
Set frm = Forms!FormAssimilation!FormAssimilationSub.Form
frm.RecordSource = "SELECT tblassimilation.PayNumber, tblassimilation.Name, tblassimilation.Asslettersigned, tblassimilation.[Assletterreceived/Posted], tblassimilation.GroupCode, tblassimilation.PayPoint " & _
"FROM tblassimilation " & _
"WHERE (((tblassimilation.GroupCode) = [Parent]![text1]) And ((tblassimilation.PayPoint) = [Parent]![Text2])) " & _
"ORDER BY tblassimilation.Name "
End If

Forms!FormAssimilation!TabCtl0 = 1

can anyone help me with this.
 
Hi,
I found another way:

this in the record source of the main form:

SELECT tblNewContactsandGCPP.[Group Code], tblNewContactsandGCPP.[Pay Point]
FROM tblNewContactsandGCPP
WHERE (((tblNewContactsandGCPP.[Group Code])=[forms]![formassimilation]![text1]) AND ((tblNewContactsandGCPP.[Pay Point])=[forms]![formassimilation]![text2]));

and then link the subform to the main form with;

like child fields = GroupCode;PayPoint
like master fields = Group Code;Pay Point

and then from a button and 2 unbound text boxes
type your group code and pay point and press:

DoCmd.Requery
Forms!FormAssimilation!TabCtl0 = 1

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top