T
Tech Geek 1234
I have a form that has a "save" command button on the form for users to save
the record before printing/previewing. On this form I have a RLSDTE and a
RLSTME field. The date field is actually stored as a date rather than text
(the person who created the database created it as text and was able to have
the following code work). I changed it to store as date. I want a warning
msgbox to pop up if the date field is not filled in.
Previously, the If statement read: "If me.RLSDTE = "Enter Date" then..."
But now that it's a date field and not text, I can't have the default text be
"Enter Date". So I'm leaving it blank. But I can't figure out how to redo
my If statement to be "If me.RLSDTE Is Null" or "If me.RLSDTE = "", then pop
up the msg box reminding the user to enter the date. Code is below:
Private Sub Command111_Click() 'Command111 is Save button on form
'This will save the record, and check the Release date and time fields
Dim Response, style, msg, Title As String
If Me.RLSDTE = "Enter Date" Then
Response = MsgBox("Do not forget to enter a Release DATE", vbOKOnly +
vbInformation, "Reminder")
RLSDTE.BackColor = vbYellow
End If
If Me.RLSTM = "Enter Time" Then
Response = MsgBox("Do not forget to enter a Release Time", vbOKOnly +
vbInformation, "Reminder")
RLSTM.BackColor = vbYellow
Else
Me.Refresh
End If
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End Sub
I feel like maybe I need to go back to VB 101 to get the right code. Can
you help?
the record before printing/previewing. On this form I have a RLSDTE and a
RLSTME field. The date field is actually stored as a date rather than text
(the person who created the database created it as text and was able to have
the following code work). I changed it to store as date. I want a warning
msgbox to pop up if the date field is not filled in.
Previously, the If statement read: "If me.RLSDTE = "Enter Date" then..."
But now that it's a date field and not text, I can't have the default text be
"Enter Date". So I'm leaving it blank. But I can't figure out how to redo
my If statement to be "If me.RLSDTE Is Null" or "If me.RLSDTE = "", then pop
up the msg box reminding the user to enter the date. Code is below:
Private Sub Command111_Click() 'Command111 is Save button on form
'This will save the record, and check the Release date and time fields
Dim Response, style, msg, Title As String
If Me.RLSDTE = "Enter Date" Then
Response = MsgBox("Do not forget to enter a Release DATE", vbOKOnly +
vbInformation, "Reminder")
RLSDTE.BackColor = vbYellow
End If
If Me.RLSTM = "Enter Time" Then
Response = MsgBox("Do not forget to enter a Release Time", vbOKOnly +
vbInformation, "Reminder")
RLSTM.BackColor = vbYellow
Else
Me.Refresh
End If
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End Sub
I feel like maybe I need to go back to VB 101 to get the right code. Can
you help?