It sounds like you don't have any error handling going on or you would not have this big question mark. I suggest you add some and as long as you are at it do it everywhere. There are a lot of approaches but here is one I use:
Originally Posted by brian goodwin
1. At the top of each procedure add the "on error goto ErrorHandler"
Private Sub Command1_Click()
10 On Error GoTo ErrorHandler
Dim x As Long
20 Debug.Print ("Line of code for demonstation of executable statements")
30 Debug.Print ("Line of code for demonstation of executable statements")
40 Debug.Print ("Line of code for demonstation of executable statements")
50 Debug.Print ("Line of code for demonstation of executable statements")
60 x = x \ 0
70 exit sub
MsgBox "Error occured in form1 - Command1_Click - line " & Erl & vbCrLf & _
"Error Details: " & Err.Number & " " & Err.Description
2. At the bottom add the error handler.
3. Include the "Exit sub" so the code does not fall into the error handler.
4. Get MZTools from here. It is free. http://www.mztools.com/v3/download.aspx
5. There is an option to add line numbers to your project all at once. It will also remove them if you don't like them.
Then when your code hits a run time error it will display:
1. The routine where it happened.
2. The line number where it occured.
3. The error messgae.
It is up front work but it will save you lots of headaches down the road.
Some people take different actions in the error hander routines like logging to a file pertinamt information. With my approach it is more basic but you would not be guessing like you are now.