K
Kelvin Beaton
I have a form that I enter a date into and then press a buton to run the
code below.
No date seem to be valid for this section of code to no display the message,
----------------------------------------------------------------------------------------------------
ElseIf Me.ImportDate > DMax([ImportDate], "qry_PSI_importdate_max") Then
MsgBox "You have already imported PSI data for this date"
----------------------------------------------------------------------------------------------------
I can enter any date and it always says "You have already imported PSI data
for this date".
I've entered dates a year from now and into the past, but no difference.
I can look in the query and see the MAX date, so I know what that is.
Can someone see what is wrong with this code?
Thanks
Kelvin
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Private Sub Command8_Click()
On Error GoTo Err_Command8_Click
Dim stDocName As String
If IsNull([ImportDate]) Then
MsgBox "You must enter an Import date."
ElseIf Me.ImportDate > DMax([ImportDate], "qry_PSI_importdate_max")
Then
MsgBox "You have already imported PSI data for this date"
Else
DoCmd.RunMacro "mac_ImportPSIData", , ""
MsgBox "PSI Data Imported Successfully."
DoCmd.Close
Exit_Command8_Click:
Exit Sub
Err_Command8_Click:
MsgBox Err.Description
Resume Exit_Command8_Click
End If
End Sub
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
code below.
No date seem to be valid for this section of code to no display the message,
----------------------------------------------------------------------------------------------------
ElseIf Me.ImportDate > DMax([ImportDate], "qry_PSI_importdate_max") Then
MsgBox "You have already imported PSI data for this date"
----------------------------------------------------------------------------------------------------
I can enter any date and it always says "You have already imported PSI data
for this date".
I've entered dates a year from now and into the past, but no difference.
I can look in the query and see the MAX date, so I know what that is.
Can someone see what is wrong with this code?
Thanks
Kelvin
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Private Sub Command8_Click()
On Error GoTo Err_Command8_Click
Dim stDocName As String
If IsNull([ImportDate]) Then
MsgBox "You must enter an Import date."
ElseIf Me.ImportDate > DMax([ImportDate], "qry_PSI_importdate_max")
Then
MsgBox "You have already imported PSI data for this date"
Else
DoCmd.RunMacro "mac_ImportPSIData", , ""
MsgBox "PSI Data Imported Successfully."
DoCmd.Close
Exit_Command8_Click:
Exit Sub
Err_Command8_Click:
MsgBox Err.Description
Resume Exit_Command8_Click
End If
End Sub
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++