Date from one form to another

gsandy

Registered User.
Local time
Tomorrow, 09:27
Joined
May 4, 2014
Messages
104
I have a form (frmHourEnter) with textbox (Week_Ending) to select a date, and a command button (cmdStaffReport) to open another form (frmStaffReport) with textbox (txtDate). The Week_Ending is not related to any table, it is just a date on a form.
The first form code is:
Code:
  Public sDate As Date
  Private Sub Week_Ending_Exit(Cancel As Integer)
        sDate = Week_Ending.Value
  End Sub
The second form (frmStaffReport) code is:
Code:
   Private Sub Form_Load()
   txtDate.Value = frmHourEnter.sDate.Value
   End Sub
On opening this form I get “Variable not defined” relating to frmHourEnter portion of frmHourEnter.sDate.Value.
How do I rectify this?
 
Forms!frmHourEnter.sDate.Value

You should also include Me in any reference to the current form.
Me.txtDate.Value
 
I will try that tomorrow and let you know.
 
I got it working by adding the "Me." and deleting the ".Value".
Thanks for your help. Cheers Sandy
 

Users who are viewing this thread

Back
Top Bottom