Search code examples
vbams-access

How to disable error message in debug window [MS-Access]


I have a form with an unbound text box. In the ControlSource of the control I have a RowNum() function to show the number of lines in my continuous form. When I open the form an error message appears in my debug window:

RowNum() error 7951

This error appears because I don't have any RecordSource yet. I'll set the RecordSource of the form after clicking a button.

Image

Is there a way to disable error message in my debug window when I'm opening the form and than enable when I'm closing the form?

I've tried with:

Application.SetOption "Unassociated Label and Control Error Checking", False

and

Application.SetOption " Invalid Control Properties Error Checking", False

but it didn't work.

Thanks for any advice.


Solution

  • Thanks to the help of community in the comment section I was able to trap the error in the error handler of this function where Debug.Print appears.