syntax: change formname control reference in vba code.
I have two forms.
Both contain some of the same control information to create an e-mail message. (sender name / recipient / subject / body / etc.) Both forms can be enabled at the same time (they're on different tabs of a multi-tab)
I have ONE module to create the e-mail object itself.
Depending on if the user clicks the "Create E-Mail" button on frmNew or frmUpdate, I want the module to gather the required information for the email from that specific form.
This is what I've been doing so far:
There is a public variable (integer) called TicketType
on the frmNew onclick event:
TicketType = 1
on the frmUpdate onlick event:
TicketType = 2
Then in the CreateEmail module/function I need it to reference the correct form / controls depending on TicketType.
I was thinking of:
If TicketType = 1
then FormName = frmMain
FormName = frmUpdate
Then I could have one reference for controls such as "OutlookTo = FormName.txtAccountNumber.Value" and it would reference the correct form. unfortunately this is not the correct way to reference form controls... so I need another way to do it.