RichardOneil
MIS
Hi-
I have a basic Access form where a user enters a from and thru date. When they click the button those dates are then converted and used as selection criteria in a query. This was working just fine until I added code trap for blank text boxes.
Option Explicit
Public Sub Command6_Click()
Dim From As String
Dim Thru As String
Dim Temp1 As String
Dim Temp2 As String
Dim Yr1 As String
Dim Yr2 As String
Dim Mo1 As String
Dim Mo2 As String
Dim Dy1 As String
Dim Dy2 As String
If Form_frmMainForm.Text2.Value Is Null Or Form_frmMainForm.Text4.Value Is Null Then
If MsgBox("From and Thru Dates Cannot Be Blank", vbOKCancel) = vbCancel Then
Exit Sub
End If
Else
Form_frmMainForm.Text2.SetFocus
End If
Any help is greatly appreciated and thank you in advance.
I have a basic Access form where a user enters a from and thru date. When they click the button those dates are then converted and used as selection criteria in a query. This was working just fine until I added code trap for blank text boxes.
Option Explicit
Public Sub Command6_Click()
Dim From As String
Dim Thru As String
Dim Temp1 As String
Dim Temp2 As String
Dim Yr1 As String
Dim Yr2 As String
Dim Mo1 As String
Dim Mo2 As String
Dim Dy1 As String
Dim Dy2 As String
If Form_frmMainForm.Text2.Value Is Null Or Form_frmMainForm.Text4.Value Is Null Then
If MsgBox("From and Thru Dates Cannot Be Blank", vbOKCancel) = vbCancel Then
Exit Sub
End If
Else
Form_frmMainForm.Text2.SetFocus
End If
Any help is greatly appreciated and thank you in advance.