Amibiguous name detected

T

Tcs

I have a progress bar in my app, which used to be a separate function in each of
my modules. But as I've added to my app, it occured to me that it would be
better if I were to create a global module for things such as this. (Or so I
thought.)

I've created my global module:

Option Compare Database
Option Explicit

Global intPBOverallMax As Variant, intPBOverallValue As Variant,
intPBOverallCntr As Variant
Global intPBTaskMax As Variant, intPBTaskValue As Variant, intPBTaskCntr As
Variant
Global ctlProgBarOverall As String, ctlProgBarTask As String


Public Function fncUpdProgBar()
On Error GoTo Err_UpdProgBar

intPBOverallCntr = intPBOverallCntr + 1
intPBTaskCntr = intPBTaskCntr + 1

If intPBOverallCntr <= intPBOverallMax Then
Forms!frmProgressBar.ctlProgBarOverall.Value = intPBOverallCntr
End If
If intPBTaskCntr <= intPBTaskMax Then
Forms!frmProgressBar.ctlProgBarTask.Value = intPBTaskCntr
End If
DoEvents

Exit_UpdProgBar:

On Error Resume Next
SysCmd acSysCmdClearStatus

Exit Function

Err_UpdProgBar:
MsgBox "Error # " & Err.Number & " was generated by " & Err.Source & vbCrLf
& _
Err.Description, , "RunJob - UpdProgBar - " & Date & " - " & Time
' intUpdProgBar = False
Resume Exit_UpdProgBar

End Function

And I have commented out the corresponding code in all my other modules. But
when I try to compile, I get:

Ambiguous name detected: intPBTaskMax

But I can't find any dups. And my progress bar form looks good. Does anyone
have any idea what I'm missing?

Thanks in advance,

Tom
 
D

Dan Artuso

Hi,
To find the duplicate declaration, with any code module open,
press Ctl+F and then choose Current Database and then enter
intPBTaskMax in the Find What box
 
T

Tcs

Thanks. The good news is that this was one I didn't know. The bad news is that
it didn't help. Oh, I saw where intPBTaskMax existed in multiple modules. But
it's SUPPOSED to. The value changes depending on what module is being executed.

I don't suppose you have any other tricks up your sleeve? <grin>
 
D

Dirk Goldgar

Tcs said:
Thanks. The good news is that this was one I didn't know. The bad
news is that it didn't help. Oh, I saw where intPBTaskMax existed in
multiple modules. But it's SUPPOSED to. The value changes depending
on what module is being executed.

PMFJI, but if you have *declared* it in multiple modules, and those
declarations are Public or Global, then you've made a mistake. A global
variable must only be declared once, anywhere in the project. Then it
can be referred to from any module. Declaring it in more than one
place -- as a global variable -- would mean having more than one storage
location allocated to the same name, in which there is no way Access or
VB can know which of those storage locations you mean when you use that
name.
 
T

Tcs

Okay, let me clarify.

Any "Dims" I did have in multiple modules I've commented out. As I did the
actual progress bar updating. Any reference I find now merely says:

intPBTaskMax = <somevalue>

within a function or sub. But "just to be on the safe side", I went searching
again. Not just once, but twice. And NO WHERE can I find anything except like
I just mentioned above. Each occurence merely sets some value. There is also a
max for the overall progress bar (my progress bar form has both an overall and
task PB), not to mention a value for both. All four occur in most of my
modules. But it is only THIS one, mentioned above, that's giving me the
heartburn.

Can there be some occurence somewhere hidden? On my form? (I've already
looked, but I'm just grabbing at straws now.)

Thanks in advance,

Tom
 
D

Dirk Goldgar

Tcs said:
Okay, let me clarify.

Any "Dims" I did have in multiple modules I've commented out. As I
did the actual progress bar updating. Any reference I find now
merely says:

intPBTaskMax = <somevalue>

within a function or sub. But "just to be on the safe side", I went
searching again. Not just once, but twice. And NO WHERE can I find
anything except like I just mentioned above. Each occurence merely
sets some value. There is also a max for the overall progress bar
(my progress bar form has both an overall and task PB), not to
mention a value for both. All four occur in most of my modules. But
it is only THIS one, mentioned above, that's giving me the heartburn.

Can there be some occurence somewhere hidden? On my form? (I've
already looked, but I'm just grabbing at straws now.)

Thanks in advance,

Tom

Hmm, that does make it harder. Do you have a control with this name? A
function?

What happens if you right-click on the name "intPBTaskMax" where you use
it in some module, and choose "Definition" from the context menu?
 
T

Tcs

Hmm, that does make it harder. Do you have a control with this name?

Not that I can see/find.
A function?
Ditto.

What happens if you right-click on the name "intPBTaskMax" where you use
it in some module, and choose "Definition" from the context menu?

Error: Identifier under cursor isn't a procedure name

I read the help. It wasn't (help).

I tried commenting out the offending line earlier. The error just moves on down
to the next occurence of the identifier.

<time out>

GOT IT! I HAD dim'd it as Public, in another module. Wow. Was THIS a pain to
find.

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top