Referring to a product ID field in a subform - access 2010

I have created an order form which contains two subforms; one for displaying customer details and one for displaying product details. I have included a command button next to the product details subform that opens another product form which allows the user to search and find a product.. Once the user selects the required product , I have a macro that goes back to the order form and tries to paste the selected product id into the products subform. Can not get access to refer to the product id on the products subform.
Maria GibbsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

IrogSintaCommented:
To refer to it, use:
Forms!NameOfForm!NameOfSubFormControl.Form!ProductID
0
Maria GibbsAuthor Commented:
Still getting error msg as shown on the below screen dump when I select command button ‘select product’ which runs macro mcr_copy_selected_product. Pls see attached doc.
error.docx
0
IrogSintaCommented:
Can you post the code where you inserted this line?

Ron
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Maria GibbsAuthor Commented:
It is part of the mcr_copy_selected_product macro which is the last screen dump in the attached file.
0
IrogSintaCommented:
My bad. I didn't realize you were using macros.  I'm not sure how you would do it using that.  That seems like a lot more work though rather than just using something like this in code:
Forms!NameOfForm!NameOfSubFormControl.Form!ProductID = Me.ProductID

Open in new window

0
Maria GibbsAuthor Commented:
Thank you but this example will be given people who have no knowledge of VBA so i need to get to work with no coding
0
IrogSintaCommented:
Okay, you need to use the SetValue action to do this.  If SetValue does not show up on the "Add New Action" dropdown, just click on the "Show All Actions" on icon on the Ribbon.  Here's what the macro looks like:

setvalue
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IrogSintaCommented:
And just in case you weren't aware, you can use the builder icon and use the builder to come up with the same syntax I presented earlier.
builder
0
Maria GibbsAuthor Commented:
I have replaced the copy/paste and gotocontrol actions in the macro with the setvalue. IT is now working, however when i try to use the gotocontrol action to pass control to the quantity field i encountered the same problem. I have attached a new file attachment showing the error msg and the macro design. Thank you for your help. Any more suggestions?//?
0
IrogSintaCommented:
I don't see a new attachment.
0
Maria GibbsAuthor Commented:
i am attaching it again
error1.docx
0
IrogSintaCommented:
I don't understand what you're trying to accomplish.  If you're trying to set the quantity, why don't you just do it the same way we did the Product_ID?
0
Maria GibbsAuthor Commented:
i am passing control to quantity so i can activate events on product ID and to actually get the gotocontrol action to work for future references.
0
IrogSintaCommented:
MariaGibbs,
I'm more familiar with vb coding so what I know in macros is from the help file and accordingly, if you use GoToControl you should only use the name of the control and not the full syntax.  Also, if you want to go the Quantity control in a subform, you need to GoToControl to the subform first, then GoToControl again to the Quantity.  

The better option is to use the SetValue action (even the help file mentions this).  You only need to do a call to SetValue once because it uses the full syntax of the control.   ( i.e. Forms!frm_order!etc... )

Ron
0
Maria GibbsAuthor Commented:
I will give it a go. Thank you for your help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.