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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking fields from master form to subform

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am attempting to link a field on a subform to a field on a form, where changing the number in the field on the form will postition the sub-form to the record indicated. Here is what I mean. We have a subform with all items and item numbers. On our main form, we type in say &quot;BK&quot; and the subform (in detail format) will be postitioned to all records beginning with BK. If we continue typing, the records will change accordingly.<br>
<br>
Here is what I have tried, but alas it is a no-go:<br>
<br>
---------------------------------------------------------<br>
Private Sub Material_Change()<br>
Dim RFM As Variant<br>
Dim stLinkCriteria As String<br>
Dim ctl As Control<br>
<br>
<br>
Set RFM = Me![Material]<br>
Forms![PRDMTLM/PRGMTLM subform].SetFocus<br>
DoCmd.FindRecord RFM, acStart, False, acSearchAll, True, acAll<br>
Forms![INFINIUM ACCESS]![Material].SetFocus<br>
End Sub<br>
-----------------------------------------------------------<br>
This returns an error '2450' the PRDMTLM/PRGMTLM subform can't be found. It is spelled correctly, I know this. Anyone have an ideas? I am just beginning to try to conquer VBA, and still find it a bit confusing. Thanks!<br>
<br>
God's Love <p>John Vogel<br><a href=mailto:john@computerwiz.net>john@computerwiz.net</a><br><a href=
 
The reason for the error is that you cannot refer to the subform directly. I think that if you replace the line with the following, it should work:<br>
<br>
Forms![Name of main form].[PRDMTLM/PRGMTLM subform].SetFocus<br>
<br>
Hope this helps<br>
<br>
Jonathan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top