Selasa, 06 September 2016

[MS_AccessPros] Help with form/query



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
' 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!


Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.



Tidak ada komentar:

Posting Komentar