user2385809
user2385809

Reputation: 1005

Error upon opening form

I am going crazy with the easiest piece of code that just won't work. I can't fugure out why. I have a button on a form that opens another form but when i click it I get the following error and don't really know what to change:

enter image description here

my code click code is:

Private Sub HSbrowse_Click()

DoCmd.OpenForm "frmSearchPCR"

End Sub

Any Ideas?

Upvotes: 4

Views: 439

Answers (3)

MooneyA
MooneyA

Reputation: 11

I've had this issue several times. I believe that it is caused by the module of your form becoming corrupt. To fix it, set the "Has Module" property of your form to "No" and save and close your form. This will delete the module and any code it contains, so you will need to copy your code first. Open the VBA window to verify that the module was deleted, then reopen your form and set its "Has Module" property back to "Yes" and paste your code back in. This method has solved this problem for me on more than one occasion.

Upvotes: 1

nicomp
nicomp

Reputation: 4647

Start by removing individual controls one-at-a-time. When your error goes away you will know the offending control, if that is indeed the problem.

Does the form have underlying data? Did you remove that to see if the problem changes?

Upvotes: 0

Klaus
Klaus

Reputation: 902

Does the current form has any ActiveX Control in it?

If not then your form may be corrupt, rebuild your database using e.g. TM-RebuildDatabase

Upvotes: 0

Related Questions