Hello!
What I am trying to do is have my database send an email to companies when their permits have expired or will expire. I have a main menu with a button for "permits expiring". The button open the "permits expiring" form which has an unbound text box "txtnotify" and a button with code the following code:
Private Sub Command2_Click()
Dim db As DAO.Database, rst As DAO.Recordset
If IsNull(DLookup("[CityPermit_ExpDate]", "[Expired Permits]")) Then
MsgBox "There are no permits expiring."
DoCmd.Close acForm, Me.Name
Else
' Point to this database
Set db = CurrentDb
' Clean out the working table
CurrentDb.Execute "DELETE * FROM [SEND TBL]", dbFailOnError
' Avoid prompts
DoCmd.SetWarnings False
' Loadin the rows to select
DoCmd.OpenQuery "Expired Permits Query"
'Turn on prompts again
DoCmd.SetWarnings True
' Clear the database object
Set db = Nothing
' Open the selection form
DoCmd.OpenForm "SEND FRM"
' Close me
DoCmd.Close acForm, Me.Name
End If
End Sub
When I enter the number of days in the "permits expiring" form, and click the run button, I am getting the message that there are no permits expiring; however, there are permits expiring. I'm not exactly sure what I'm doing wrong. If needed, I can upload the database.
Your help is greatly appreciated!
Kat
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (1) |
Tidak ada komentar:
Posting Komentar