PC User
Registered User.
- Local time
- Today, 02:21
- Joined
- Jul 28, 2002
- Messages
- 193
I've adopted a programming style of switching between subforms, instead of opening and closing forms. Although I've linked between a main form and a popup form, now I need to link between opening and closing subforms. I've tried to use a global variable to store my key field's value (BusinessID), but Access 2007 acts strangely in that it returns the string with the name of the business and not its ID number. I've tried to prevent this by defining the global variable as an integer (Public gintBusinessID As Integer), but it still returns a string.
Basically, I need to switch from one subform which can have multiple records related to it in another subform. The problem in switching between subforms is that when the second subform appears the previous subform is no longer there to reference and pick up the value of the BusinessID. That is why I tried to use a global variable. Has anyone used this technique and have an example of its use.
To switch between subforms, I use the following code:
I've searched through this forum and I haven't found anything on this technique.
Thanks,
PC
Basically, I need to switch from one subform which can have multiple records related to it in another subform. The problem in switching between subforms is that when the second subform appears the previous subform is no longer there to reference and pick up the value of the BusinessID. That is why I tried to use a global variable. Has anyone used this technique and have an example of its use.
To switch between subforms, I use the following code:
Code:
Private Sub btnCESWpage_Click()
Forms("frmMAIN")!ctlGenericSubform.SourceObject = "ffrelcolaExemptTreatment"
Forms("frmMAIN")!ctlGenericSubform.BusinessID = gintBusinessID
End Sub
Thanks,
PC
Last edited: