Problem with a form...

  • Thread starter Thread starter Tcs
  • Start date Start date
T

Tcs

I have a db I've worked on for months. It includes a pogress bar form, which I
want to use in other dbs I work on. That time has arrived. I exported my form
from my old db to my new.

When I try to run the same code that runs in my old db, I get an error. The
code:

Forms!frmProgressBar.ctlProgBarOverall.Max = 3
Forms!frmProgressBar.ctlProgBarTask.Max = intRecsToRead
DoCmd.OpenForm "frmProgressBar"
Forms!frmProgressBar.Caption = "Processing Catalog File..."
DoEvents

The error:

Microsoft Access can't find the form 'frmProgressBar' referred to in a macro
expression or Visual Basic code.

So I went back to what I was working on Friday. Trying to find out how to get
"Microsoft ProgressBar Control 6.0 (SP4)" to show up in Tools | ActiveX
Controls. I found I needed "mscomctl.ocx". I registered it, from the command
line. Then I went back into my new db and went into Tools | ActiveX again. NOW
I could find my missing "Microsoft ProgressBar Control 6.0 (SP4)" in my new db.

BUT...

How do I get to it? I STILL don't have "Microsoft Windows Common Controls 6.0
(SP4)" showing up in my VBA | Tools | Reference window. I'm assuming that this
is what I still need, as this is what shows up in my old db (which works) but
not in my new (even after registering "mscomctl.ocx".)

Does anyone know, or can someone point me to, an explanation of how this is
SUPPOSED to work...and perhaps even tell me what I need to do right now to fix
my problem?

Thanks SO VERY much, in advance,

Tom
 
Sometimes, for reasons I've never been able to determine, not all of the
registered controls show up in the list. When that happens, simply on the
Browse button in the References dialog box, and either navigate to the
control or type its fully-qualified path.
 
Thanks. And I'm pretty sure that I got it done, seeing as I could see my ms
progress bar control, then the common controls. And I learned that I HAVE to
have SOME code, or Access won't remember what I told it. :(

But I still have same error. Like it can't find the *form*, rather than a
control on the form. But it's THERE! I can see it! How could it not find it?

<time out>

I went back and fiddled some more. Got it to work. I thought that perhaps I
hadn't opened it. But that's exactly what I was trying to do. So *that* wasn't
it. I *did* notice that I hadn't set the value of the records to read. When I
did that...it worked.

Thanks very much,

Tom
 
It looks to me like your first two lines of code will fail if the form is
closed when the code runs. When you use the syntax:

Forms!YourFormNameHere

, Access only recognizes the *forms that are open at the time*. It doesn't
matter that they exist in the database window, they are not part of the
Forms collection until they are opened, whether that's in Design or Form
mode, visible or invisible. Thus this error message does not distinguish
between temporarily closed forms or mispelled form names. How annoying!

I think you want to open the progress bar form invisibly before you make any
adjustments. You need the form open before you can do anything with its
controls. I bet your old db had the form open somehow before this code
ran:
'new code
Docmd.OpenForm "frmProgressBar",acNormal, , , , acHidden 'open the form
invisibly so we can make adjustments
'old code
Forms!frmProgressBar.ctlProgBarOverall.Max = 3
Forms!frmProgressBar.ctlProgBarTask.Max = intRecsToRead
DoCmd.OpenForm "frmProgressBar" 'Show the form to the user
Forms!frmProgressBar.Caption = "Processing Catalog File..."
DoEvents
----------

HTH,

Kevin
 
Back
Top