Passing unbound variable to a sub form

skeylargo

New Member
Joined
Sep 18, 2016
Messages
14
I am trying to add some more data and functionality to an existing database and having trouble figuring out how to pass the value that is being passed to main form also to the sub form. The reg# on main form is unbound. The reason the Reg# is passed as a variable I think is because that variable is used to get data from external data source.

From the frm_SalesTeam, double click on Reg# opens frm_SalesDriverInfo

Private Sub Reg___DblClick(Cancel As Integer)

Dim reg As String
reg = Me![Reg #]
DoCmd.OpenForm "frm_SalesDriverInfo"
Form_frm_SalesDriverInfo.tex_RegNum = reg
End Sub

Now in frm_SalesDriverInfo form I also want to display associated notes and the idea is to have a sub form for the notes but I don’t know how to pass the reg# to the sub form frm_SalesNotes to display associated notes as the frm_SalesDriverInfo opens. If it is easier to add a button "get notes" that would be ok also.

I really do not know VB so if you can help, please dumb it down for me :)
 
Last edited:

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Not really sure what you're doing but U can trial removing the Dim statement in your sub for the Reg variable and placing this in a module. HTH. Dave
Code:
Public Reg As String
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top