Hello,
I have have this code in the click event of a form that updates the database table with the current date when the button is pressed and it used to always then update a text box on the form with the date, but suddenly it just stopped working. I haven't changed anything. Everything I read says to use refresh and requery, but I am doing all of that and it still doesn't update. I have stepped through the code in VB and it does get through the code and I can run a query on the table on the server and I see that the table updates immediately. I can only see the updated date if I got out of the form and go back in now. Does anyone have any ideas?
Dim EncNbr As String
EncNbr = Me.EncounterNbr
With CodeContextObject
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE dbo_Providers SET dbo_Providers.DateEmailed = Now()" & _
"WHERE (((dbo_Providers.ProvTbleID)=[Forms]![frm_SendVarianceNotice]![ProvTbleID]))"
Me.DateEmailed.Requery
DoCmd.SetWarnings True
Me.Refresh
Me.Requery
DoCmd.SendObject acReport, "rpt_VariancesbyProvider_SendEmail", "PDFFormat(*.pdf)", .ProviderEmail, "", "", "#secure# Preliminary Variance Notification - Request Review Within 10 Days", "The attached quality measure did not comply with CMS guidelines and you have been assigned the variance" & " " & "For Enc#: " & EncNbr & "." & " " & "Please review and if you can demonstrate Core Measure CMS compliance respond to this notice within 10 days.", True, ""
End With
I have have this code in the click event of a form that updates the database table with the current date when the button is pressed and it used to always then update a text box on the form with the date, but suddenly it just stopped working. I haven't changed anything. Everything I read says to use refresh and requery, but I am doing all of that and it still doesn't update. I have stepped through the code in VB and it does get through the code and I can run a query on the table on the server and I see that the table updates immediately. I can only see the updated date if I got out of the form and go back in now. Does anyone have any ideas?
Dim EncNbr As String
EncNbr = Me.EncounterNbr
With CodeContextObject
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE dbo_Providers SET dbo_Providers.DateEmailed = Now()" & _
"WHERE (((dbo_Providers.ProvTbleID)=[Forms]![frm_SendVarianceNotice]![ProvTbleID]))"
Me.DateEmailed.Requery
DoCmd.SetWarnings True
Me.Refresh
Me.Requery
DoCmd.SendObject acReport, "rpt_VariancesbyProvider_SendEmail", "PDFFormat(*.pdf)", .ProviderEmail, "", "", "#secure# Preliminary Variance Notification - Request Review Within 10 Days", "The attached quality measure did not comply with CMS guidelines and you have been assigned the variance" & " " & "For Enc#: " & EncNbr & "." & " " & "Please review and if you can demonstrate Core Measure CMS compliance respond to this notice within 10 days.", True, ""
End With