G
Guest
Hi, there. I am trying to combine a bit of code and it seems that it works
sometimes (it updates the table) and sometimes it doesn't.
With help from the group, I've created a form with a command button. The
command button runs a report and updates the table, in theory. I've tested
it, it worked, then I deleted the data from the table and tried again, but it
didn't update the 2nd time. I'm horrible at coding and appreciate your
suggestions.
Private Sub PrintLetter_Click()
"Sends all donors that have not yet been sent letters or
'where the DateSent field is before Oct.1st of that current year.
'Letters marked before that will be sent. Letters after that date will not.
On Error GoTo Err_PrintLetter_Click
DoCmd.OpenReport "Solicitation Letter", acViewNormal, , "[DateSent] Is Null
Or [DateSent] < DateSerial(Year(Date()),10,1)"
Dim strSQL As String
strSQL = "Update tblAuctionDonors Set tblAuctionDonors.DateSent= #" & Date &
"# Where tblAuctionDonors.[AuctionDonorID] = " & [AuctionDonorID] & ";"
Exit_PrintLetter_Click:
Exit Sub
Err_PrintLetter_Click:
MsgBox Err.Description
Resume Exit_PrintLetter_Click
End Sub
sometimes (it updates the table) and sometimes it doesn't.
With help from the group, I've created a form with a command button. The
command button runs a report and updates the table, in theory. I've tested
it, it worked, then I deleted the data from the table and tried again, but it
didn't update the 2nd time. I'm horrible at coding and appreciate your
suggestions.
Private Sub PrintLetter_Click()
"Sends all donors that have not yet been sent letters or
'where the DateSent field is before Oct.1st of that current year.
'Letters marked before that will be sent. Letters after that date will not.
On Error GoTo Err_PrintLetter_Click
DoCmd.OpenReport "Solicitation Letter", acViewNormal, , "[DateSent] Is Null
Or [DateSent] < DateSerial(Year(Date()),10,1)"
Dim strSQL As String
strSQL = "Update tblAuctionDonors Set tblAuctionDonors.DateSent= #" & Date &
"# Where tblAuctionDonors.[AuctionDonorID] = " & [AuctionDonorID] & ";"
Exit_PrintLetter_Click:
Exit Sub
Err_PrintLetter_Click:
MsgBox Err.Description
Resume Exit_PrintLetter_Click
End Sub