B
Billy B
I have the following code and get an error message at the docmd.runsql line.
What is wrong with my syntax?
Private Sub Form_Close()
Dim datCurrDate As Date, datNewDate As Date
Dim strSQL1 As String, strSQ2 As String, strSQLFull As String
strSQL1 = "UPDATE sysTbl SET [ReturnVal] = "
strSQL2 = "WHERE [Comparison]='Backup’;"
datCurrDate = Date
datNewDate = datCurrDate + 30
strSQLFull = strSQL1 & datNewDate & strSQL2
'Gets text date value from tblSys
strResetsysTblDate = DLookup("[ReturnVal]", "tblSys", "[Comparison] =
""Backup""")
'Converts text in sysTbl to date value
strResetsysTblDate = DateValue(strResetsysTblDate)
If datCurrDate >= strResetsysTblDate Then
MsgBox "It has been more than 30 days since your last backup " &
vbNewLine & _
"Please consider doing a backup after this form closes " &
vbNewLine & vbNewLine & _
"You will not be reminded for another 30 days "
DoCmd.RunSQL strSQLFull
End If
What is wrong with my syntax?
Private Sub Form_Close()
Dim datCurrDate As Date, datNewDate As Date
Dim strSQL1 As String, strSQ2 As String, strSQLFull As String
strSQL1 = "UPDATE sysTbl SET [ReturnVal] = "
strSQL2 = "WHERE [Comparison]='Backup’;"
datCurrDate = Date
datNewDate = datCurrDate + 30
strSQLFull = strSQL1 & datNewDate & strSQL2
'Gets text date value from tblSys
strResetsysTblDate = DLookup("[ReturnVal]", "tblSys", "[Comparison] =
""Backup""")
'Converts text in sysTbl to date value
strResetsysTblDate = DateValue(strResetsysTblDate)
If datCurrDate >= strResetsysTblDate Then
MsgBox "It has been more than 30 days since your last backup " &
vbNewLine & _
"Please consider doing a backup after this form closes " &
vbNewLine & vbNewLine & _
"You will not be reminded for another 30 days "
DoCmd.RunSQL strSQLFull
End If