Hi all,
I've used a global variable declared in a standard module. It takes its value from form A and I want to display that value in a control in form B.
Although this is my first experience working with modules and global variables but it surprisingly worked the way it was supposed to.
Unfortunately after some other works when I came back and retest the form that uses the global variable I realized it is not working properly.
I can see the desired value is assigned to my global variable using AfterUpdate event of an Option Group in form A but it is not shown in form B even once I re-query my form B.
Please help me to understand the issue and fix it. Some parts of my VBA codes are given here.
And this is my standard module, I called it as its default name: "Module1"
The default value of the control in form B (frm_everything) is myvarF in its property sheet.
I've used a global variable declared in a standard module. It takes its value from form A and I want to display that value in a control in form B.
Although this is my first experience working with modules and global variables but it surprisingly worked the way it was supposed to.
Unfortunately after some other works when I came back and retest the form that uses the global variable I realized it is not working properly.
I can see the desired value is assigned to my global variable using AfterUpdate event of an Option Group in form A but it is not shown in form B even once I re-query my form B.
Please help me to understand the issue and fix it. Some parts of my VBA codes are given here.
Code:
Private Sub opt_AmPm_F_AfterUpdate()
hh_F = Me.opt_hours_F
mm_F = Me.opt_minutes_F
ap_F = Me.opt_AmPm_F
If (ap_F = 1) Then
ampm_F = "AM"
Else
ampm_F = "PM"
End If
If (mm_F = 0) Then
mm_F = "00"
Else
mm_F = mm_F
End If
myvarF = hh_F & ":" & mm_F & " " & ampm_F
Me.txt_temp_F = myvarF
Forms!frm_everything.Requery
End Sub
Code:
Option Compare Database
Global myvarF As String