SetLinkCriteria From Subform Tab Control

  • Thread starter Thread starter Mike Boozer
  • Start date Start date
M

Mike Boozer

This has to be a simple syntax issue. I have a main form called 'AdminMain"
that has the field "IDPartNo" on it. I also have a tab control on this form.
On the tab control, I have a subform called "MSDSDocsTabSubform". I have a
command button on this subform to open another form for user to add data.
The other form is called "MSDSMgmt" which also has the field "IDPartNo".
I've tried all sorts of syntax and it isnot working. The form opens okay but
its does not link and only displays an empty record. Help?

stDocName = "MSDSMgmt"
stLinkCriteria = "Forms!AdminMain.IDPartNo" = " & Me.IDPartNo"
DoCmd.OpenForm stDocName, , , stLinkCriteria
 
Try:

stDocName = "MSDSMgmt"
sLinkCriteria = "IDParNum = " me.Parent.IDPartNo
DoCmd.OpenForm stDocName, , , stLinkCriteria
 
Mike said:
This has to be a simple syntax issue. I have a main form called 'AdminMain"
that has the field "IDPartNo" on it. I also have a tab control on this form.
On the tab control, I have a subform called "MSDSDocsTabSubform". I have a
command button on this subform to open another form for user to add data.
The other form is called "MSDSMgmt" which also has the field "IDPartNo".
I've tried all sorts of syntax and it isnot working. The form opens okay but
its does not link and only displays an empty record. Help?

stDocName = "MSDSMgmt"
stLinkCriteria = "Forms!AdminMain.IDPartNo" = " & Me.IDPartNo"
DoCmd.OpenForm stDocName, , , stLinkCriteria


You need to use the name of the field in the other form's
record source tqble/query. not a control on the other form.

stLinkCriteria = "IDPartNo = " & Me.IDPartNo

or if the IDPartNo field is a text field:

stLinkCriteria = "IDPartNo = """ & Me.IDPartNo & """"
 
Back
Top