Grab and return Item from one form to other in Access VBA
Grab and return Item from one form to other in Access VBA
Since it's the first time I do this, I want to know the best approach or right way to get the result.
I have a form (Quote) where I have a List Box to add items. I also have another form (Search Item) where I can find all the items in my database. Where I want to do is to grab an item from the Search Item box and put it in my Quote Form List Box.
I was thinking to put a Global Variable that will store the ID of the item and use this as pin point reference to paste in the Quote List Box.
Is this the right way to it or am I missing something here?
1 Answer
1
To reference the form you're currently on:
Me
To reference a textbox control in the form you're currently on:
Me.txtbox_name_here
To reference a form from another form:
Dim frm As Form
'first you need to open the form to reference it
DoCmd.OpenForm "form name here", acNormal
'references the form the form
Set frm = Forms("form name here")
'when you're done remember to close the form with this
DoCmd.Close acForm, "form name here", acSaveYes
To reference another form's textbox control, using the frm variable I made earlier:
frm.txtbox_name_here
This should be enough information for you to get started.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.