I am requesting some guidance to fix this problem I have been having while trying to edit the “AfterUpdate” event in my database. It seems to work fine on my local machine but when I try to implement it in the network database it doesn’t work properly (occasionally puts in a random date in one of the fields, doesn’t erase the date when I supply a new ID, etc.)
Here is the VBA Code I have:
Private Sub provider_surveyID_AfterUpdate()
provider_survey_dueDate = DateAdd("ww", 2, DLookup("completed_on",
"qry_ProviderSurveyInfo", "provider_surveyID=" & provider_surveyID))
provider_survey_reminder2weeks = DateAdd("ww", 4, DLookup("completed_on",
"qry_ProviderSurveyInfo", "provider_surveyID=" & provider_surveyID))
provider_survey_reminder4weeks = DateAdd("ww", 6, DLookup("completed_on",
"qry_ProviderSurveyInfo", "provider_surveyID=" & provider_surveyID))
End Sub
The query is correct, joining the Survey ID to the appropriate participant to determine the original “completed_on” date that is used in the DateAdd functions.
Can you see any reason why it would not work as it does on local – removing dates when entering IDs currently not in use? Also, think it would be wise to use Nz(provider_surveyID,0) in this instance? I haven’t implemented it yet as I wanted to make it work appropriately as it does on my local with no issues whatsoever – I enter for the ID, it populates; I enter 20 (not in use yet), it makes all dates null again.
Dlookups can be slow and tricky to use, it will also return random values when the Criteria isn’t entered. I’m not sure on how your form is put together (I’m assuming it’s a form), and this may be a partial answer: