By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,493 Members | 1,233 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,493 IT Pros & Developers. It's quick & easy.

Displaying Code modules

P: 3
I would like to display the area within a code module where certain text appears.

The module concerned has numerous lines containing code such as:
If x Then AddErr 35
If y then AddErr 45
etc etc

The code below works (from a form or other module)

Dim l1 as long, l2 as long, c1 as long, c2 as long
Dim bolFound as Boolean
Dim mdl as module
DoCmd.OpenModule "modProcessingBS"
Set mdl = Modules("modProcessingBS")
bolFound = mdl.Find("AddErr 35", l1, c1, l2, c2, True)
debug.print bolFound

Always bolFound is True, but the module display is where it was last opened, not where the line containing "AddErr 35" is to be found. I swear that earlier today Access did exactly this, but no longer. Frustrating. Can anyone help?

I am using Access 2002 - although I doubt it makes much difference!

Many thanks to anyone who can help!
Oct 9 '07 #1
Share this Question
Share on Google+
3 Replies


nico5038
Expert 2.5K+
P: 3,072
Don't know why you want the module to open at the found line, but why not use the Edit/Find to determine the location ?
This allows a search per function, module or even all code with a full or partial match of the string....

Nic;o)
Oct 9 '07 #2

P: 3
Don't know why you want the module to open at the found line, but why not use the Edit/Find to determine the location ?
This allows a search per function, module or even all code with a full or partial match of the string....

Nic;o)
Well, when I view error 35, I want to be able to go straight to the code that generates that error. Why don't I want to use find? Quite simply, it is slow
Oct 11 '07 #3

nico5038
Expert 2.5K+
P: 3,072
Hmm, a slow find is new to me. I've been using it many times and certainly when you have just one module (and set the Find to the "Within Module" scope) I never experienced slow performance.

I only use the module object for extensive automated updates and your .find is a new approach for me :-)

Nic;o)
Oct 11 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.