0

An Access application that has been working fine for years all of a sudden has started freezing any time someone uses the Search for POAs button. This button is an embedded macro that doesn't seem to do much other than assign two variables and attempt to open a form. It's when the form tries to open that it now freezes the app and you have to Ctrl+Shift+Esc to shut it down and reopen the app.

I'm not sure how to diagnose the issue without it being actual VBA code. I've attempted to first remove the embedded macro and turn it into VBA but I am getting different results than what it previously did. With the embedded macro (when it was working) when you would use the search button it would provide filtered results. But when I tried to recreate it, it simply opens the form.

enter image description here

Here is a pic of the embedded macro and then here is the code I tried to use to recreate it.

Private Sub Command155_Click()

Dim EString, EType As String

    EString = Me.Text5
    EType = Me.Text1
    
    DoCmd.OpenForm ("frmSigSearchResults"), acFormDS, , , acFormReadOnly, acDialog

End Sub

So my question is, is there a good way to diagnose why the embedded macro isn't working? And/or is there a reason why the VBA code isn't doing the same thing that the embedded macro was doing after I replaced it?

4
  • I don't know if would cause issue, but the parentheses are not needed in OpenForm command. Two variables are declared but not used. What is the form RecordSource? If it references TempVars, the VBA does not declare and set TempVars. The query would not recognize the VBA variables. Commented May 24, 2022 at 22:44
  • So, if query does reference TempVars, either remove them or declare and set in VBA. Otherwise, build OpenForm WHERE CONDITION filter criteria in VBA. stackoverflow.com/questions/29107108/… Commented May 25, 2022 at 0:16
  • Side note: In VBA, every variable must be explicitly declared or it will default to Variant. Dim EString, EType As String only declares EType as String. EString is not explicitly declared so it is Variant type. Commented May 25, 2022 at 0:19
  • Cannot determine why your app 'suddenly' stopped working properly. Sometimes weirdness is corruption that cannot be explained. Commented May 25, 2022 at 0:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.