How to open 'VBA Document' code

Les Isaacs

Registered User.
Local time
Today, 17:58
Joined
May 6, 2008
Messages
186
Hi All
I have written a procedure into my error handling that writes all the error details to a table, so that I can audit/fix the errors that occur. I have a form frmErrors that displays the unfixed errors in continuous form view, with a button in the detail section that uses DoCmd.OpenModule to open the module and the procedure where the error occurred. This works pretty well :), but:
  1. Rather than just going to the top of the procedure, can I add anything to the DoCmd.OpenModule command so that I go straight to the line number in question (the line number - like the module name and procedure name - is given as a field on frmErrors)
  2. The DoCmd.OpenModule obviously only works where the error occurred in a 'module' that is viewable from the main db window, but if the error occurred say in the onclick event of a button the 'module type' is 'VBA Document' and so DoCmd.OpenModule doesn't work. Is there code that will open the code in a 'VBA Document' (the name of which will be the name of the form - which is also available from frmErrors)?
Thanks for any help
Les
 
Hi

Thanks for that link.

I've had a very good look at all the info there, and there is a lot that will be useful to me, but as far as I can see it doesn't tell me how to open the VBA window at the code of a specified 'VBA document'.

It seems to me that there should be something like a DoCmd.OpenForm command that will take "VBA" as the 2nd (view) parameter: now that would be (too!) cool :cool:

An alternative would be to use DoCmd.OpenModule to open the VBA window at some arbitrary procedure, and then run some further code to find the required Procedure name: but I'm blowed if I can work out that further code :banghead:

Any ideas?
Thanks again
Les
 

Users who are viewing this thread

Back
Top Bottom