Long-time reader, first-time poster... I am stumped!
I have a form our staff use for record management (dynaset), and another form that other users input data into that goes into our main form. In order to search the most recent records, we are refreshing the form's dynaset before bringing up the Find and Replace dialog with the following code:
The refresh works as expected, and the Find dialog works. However, since implementing this change, our admins have been encountering a "Can't Use Find and Replace Now" error message when they click out of MS Access into MS word or Outlook, and click back to Access.
Is there a way I can suppress this error message, or change my code to prevent this?
I've tested, and without the new code, the Find and Replace dialog box stays open and does not create the error message when MS Access loses focus.
I have a form our staff use for record management (dynaset), and another form that other users input data into that goes into our main form. In order to search the most recent records, we are refreshing the form's dynaset before bringing up the Find and Replace dialog with the following code:
Code:
Private Sub Cmd_FindRecord_Click()
On Error GoTo Err_Cmd_FindRecord_Click
Application.Echo False
Dim ctlPrevious As Control
Set ctlPrevious = Screen.PreviousControl
If IsNull(Me.ClmID) Then
Me.Requery
DoCmd.GoToRecord , , acNewRec
Else
Dim recordIDNumber As Long
recordIDNumber = Me.ClmID
Me.Requery
With Me.Recordset
.FindFirst "ClmID=" + CStr(recordIDNumber)
End With
End If
Application.Echo True
ctlPrevious.SetFocus
DoCmd.RunCommand acCmdFind
Exit_Cmd_FindRecord_Click:
Exit Sub
Err_Cmd_FindRecord_Click:
Resume Exit_Cmd_FindRecord_Click
End Sub
Is there a way I can suppress this error message, or change my code to prevent this?
I've tested, and without the new code, the Find and Replace dialog box stays open and does not create the error message when MS Access loses focus.