Hello I am trying to access a text field placed in another form. but i could not use it. All i wanted to was.. if the date entered in the form is less than today's date, the user needs to alter it.. else the management should come and override it by granting it permission to put a older date.. the following is the condition..
Private Sub START_DATE_BeforeUpdate(Cancel As Integer)
If [START DATE].Value <= Date - 7 Then
msg = "Please contact Management. Press OK to override, Cancel to edit date"
Val = MsgBox(msg, vbOKCancel)
If Val = 1 Then
typ = PasswordInputBox("Enter the password to proceed")
If typ = "grant" Then
MsgBox ("SUCESS")
Else
MsgBox ("VERIFICATION Failed !")
[START DATE].DefaultValue = Date
End If
Else
[START DATE].DefaultValue = Date
End If
End If
End Sub
I also want the default valure of this start date field to be todays date.. which does not seem to be working either..
I also want the default valure of this start date field to be todays date..
The PasswordInputBox is a user defined function as I needed a password field input box.. the following is the code for it..
Function PasswordInputBox( _
Prompt As String, _
Optional TITLE As String = vbNullString, _
Optional Default As String = vbNullString _
) As String
Dim strOpenArgs As String
strOpenArgs = "Prompt=" & Prompt
If Len(TITLE) > 0 Then
strOpenArgs = strOpenArgs & "~Title=" & TITLE
End If
If Len(Default) > 0 Then
strOpenArgs = strOpenArgs & "~Default=" & Default
End If
DoCmd.OpenForm FormName:="frmInputBox_Password", _
View:=acNormal, _
WindowMode:=acDialog
If CurrentProject.AllForms("frmInputBox_Password").Is Loaded Then
PasswordInputBox = Forms![frmInputBox_Password]!Text3
DoCmd.Close acForm, "frmInputBox_Password"
Else
PasswordInputBox = vbNullString
End If
End Function
the highlighted line is where i want to return whatever is entered into the field.. the following line also does not seem to work.. once OK is pressed it needs to close which is not happening.. please someone help me..
I can provide the coding for the other form if it is necessary..