A
Armin
I've been trying to make this code work.What I'm trying to
do is if the Expdate was NULL before update it should run
the Reminder function, else it should update the ExpDate.I
was able to get it to work with
If slRecordsAffected = 0 Then
Reminder
However, I would like to do it without running the SQL if
the expdate field is empty.Following code does not work.
Thanks in advance
Armin
Private Sub Expdate_AfterUpdate()
Dim strSQL As String, cn As ADODB.Connection,
slRecordsAffected As Long
If (Me!Expdate.BeforeUpdate) = Null Then
Reminder ' FUNCTION THAT ADDS A REMINDER
Else
strSQL = " UPDATE tblreminder SET " _
& "tblreminder.remdate = '" & Me.Expdate & " '," _
& "tblreminder.note = 'Deadline for this
application is on " & Me.Expdate & "'" _
& "WHERE [ApplicID]= " & Me.ApplicID & " AND
[remapplic] = -1"
Set cn = CurrentProject.Connection
cn.Execute strSQL, slRecordsAffected
'If slRecordsAffected = 0 Then
'Reminder
'Else
MsgBox "Expiration date has been updated!", ,
cn.Close
End If
End Sub
do is if the Expdate was NULL before update it should run
the Reminder function, else it should update the ExpDate.I
was able to get it to work with
If slRecordsAffected = 0 Then
Reminder
However, I would like to do it without running the SQL if
the expdate field is empty.Following code does not work.
Thanks in advance
Armin
Private Sub Expdate_AfterUpdate()
Dim strSQL As String, cn As ADODB.Connection,
slRecordsAffected As Long
If (Me!Expdate.BeforeUpdate) = Null Then
Reminder ' FUNCTION THAT ADDS A REMINDER
Else
strSQL = " UPDATE tblreminder SET " _
& "tblreminder.remdate = '" & Me.Expdate & " '," _
& "tblreminder.note = 'Deadline for this
application is on " & Me.Expdate & "'" _
& "WHERE [ApplicID]= " & Me.ApplicID & " AND
[remapplic] = -1"
Set cn = CurrentProject.Connection
cn.Execute strSQL, slRecordsAffected
'If slRecordsAffected = 0 Then
'Reminder
'Else
MsgBox "Expiration date has been updated!", ,
cn.Close
End If
End Sub