SetLinkCriteria From Subform Tab Control

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
 
A

Albert D. Kallal

Try:

stDocName = "MSDSMgmt"
sLinkCriteria = "IDParNum = " me.Parent.IDPartNo
DoCmd.OpenForm stDocName, , , stLinkCriteria
 
M

Marshall Barton

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 & """"
 

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