Change one setting on ALL forms instantly

  • Thread starter Thread starter Jeff Conrad
  • Start date Start date
J

Jeff Conrad

Hi,

Using Access 97 here.

I've made my own help file (.hlp type) for an application
and have been using it successfully for a long time. It is
accessed by going to my custom menu bar and selecting
Help. Everything is fine.

I have just recently discovered that in a form's
properties area there is a line that says "Help File." If
I type in the path to my custom help file and hit F1 when
the form is open my custom help menu appears instead of
the general Access one. This is sweet! (Yes, I know I'm a
little slow, please forgive)

Well, here's the problem: I have a LOT of forms! Instead
of using the word "lazy" I'd like to think I can be
more "efficient" <g> and change this setting on all forms
all at once with my magic Access wand.

So, is there some nifty code that I could put in a module
that I can run from the immediate window that would:

1. Open each form in Design View
2. Enter say a path like C:\MyFolder\MyHelpFile.hlp into
the Help File form property setting
3. Save and close the form
4. Then go on to the next form, etc.

Does that make sense?

Anyone have any slick Access code that could do this?
Also, would the same code work for Access 2000?

Thanks for any help,
Jeff Conrad
Bend, Oregon
 
Jeff Conrad said:
Hi,

Using Access 97 here.

I've made my own help file (.hlp type) for an application
and have been using it successfully for a long time. It is
accessed by going to my custom menu bar and selecting
Help. Everything is fine.

I have just recently discovered that in a form's
properties area there is a line that says "Help File." If
I type in the path to my custom help file and hit F1 when
the form is open my custom help menu appears instead of
the general Access one. This is sweet! (Yes, I know I'm a
little slow, please forgive)

Well, here's the problem: I have a LOT of forms! Instead
of using the word "lazy" I'd like to think I can be
more "efficient" <g> and change this setting on all forms
all at once with my magic Access wand.

So, is there some nifty code that I could put in a module
that I can run from the immediate window that would:

1. Open each form in Design View
2. Enter say a path like C:\MyFolder\MyHelpFile.hlp into
the Help File form property setting
3. Save and close the form
4. Then go on to the next form, etc.

Does that make sense?

Anyone have any slick Access code that could do this?
Also, would the same code work for Access 2000?

Hi, Jeff -

This is air code, but it should be close:

Dim db As Database
Dim cnt As Container
Dim doc As Document
Dim frm As Form

Set db = CurrentDb
Set cnt = db.Containers("Forms")

For Each doc in cnt.Documents
SysCmd acSysCmdSetStatus "Processing form: " & doc.Name
DoCmd.OpenForm doc.Name, acDesign, _
WindowMode:=acHidden
Forms(doc.Name).HelpFile = "C:\MyFolder\MyHelpFile.hlp"
DoCmd.Close acForm, doc.Name, acSaveYes
Next doc

SysCmd acSysCmdClearStatus

Set cnt = Nothing
Set db = Nothing

MsgBox "All done."
 
Hi Yoda!

Thanks for your time.

Well I must say your "air" code is pretty darn good. The
compiler only had a problem with one line:

SysCmd acSysCmdSetStatus "Processing form: " & doc.Name

I looked in the help file for the syntax and through trial
and error I found it was missing one comma:

SysCmd acSysCmdSetStatus, "Processing form: " & doc.Name

Now it works perfect! Every form instantly changed like
magic. I did some further experimentation and made another
function that will change all the reports as well. Works
just fine.

Thanks again Yoda, this is just what I needed!
Jeff Conrad
Bend, Oregon
 
Jeff Conrad said:
The compiler only had a problem with one line: [snip]
I looked in the help file for the syntax and through trial
and error I found it was missing one comma:

SysCmd acSysCmdSetStatus, "Processing form: " & doc.Name
Drat!

Now it works perfect!

That's some consolation.
I did some further experimentation and made another
function that will change all the reports as well.

Well done.
 
Back
Top