D
DJW
I was entering the same code on two different forms. I thought it would be
easier and create a module and in the module write the code once. Then I
thought I could just "call" the routine as a Public Sub. This the code
currently on my form called Hiring is:
Option Compare Database
Private Sub Form_Open(Cancel As Integer)
Call Verify
End Sub
The code below works on the form "Hiring" by itself as a Private Sub. I
know I'm on the right track as the message below in the stated Public Sub
when I call it is displayed. What I can't get it to do is run the code
after the message. It does not seem to want to reference the fields I have
on my form I called it from. It does not like the Me. reference. How do I
write the code to do the actions I want?
This is the code in my module (named Mod1)
Option Compare Database
Public Sub Verify()
MsgBox "Check the name"
If IsNull (Me!HireDate) Then
Me.HireDate= Now()
Me.ProgramName.Value = Me.Label0.Caption
Me.VersionInfo.Value = Me.Label1.Caption
End If
Thank you.
End Sub
easier and create a module and in the module write the code once. Then I
thought I could just "call" the routine as a Public Sub. This the code
currently on my form called Hiring is:
Option Compare Database
Private Sub Form_Open(Cancel As Integer)
Call Verify
End Sub
The code below works on the form "Hiring" by itself as a Private Sub. I
know I'm on the right track as the message below in the stated Public Sub
when I call it is displayed. What I can't get it to do is run the code
after the message. It does not seem to want to reference the fields I have
on my form I called it from. It does not like the Me. reference. How do I
write the code to do the actions I want?
This is the code in my module (named Mod1)
Option Compare Database
Public Sub Verify()
MsgBox "Check the name"
If IsNull (Me!HireDate) Then
Me.HireDate= Now()
Me.ProgramName.Value = Me.Label0.Caption
Me.VersionInfo.Value = Me.Label1.Caption
End If
Thank you.
End Sub