473,698 Members | 2,594 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to cycle thru ALL forms?

MLH
Am having trouble with the following
snippet. It stops after only cycling thru
open forms. There are many more than
that. How to modify this to cycle thru
all forms?

Sub AllOpenForms()
Dim frm As Form
' Enumerate Forms collection.
For Each frm In Forms
' Print name of form.
Debug.Print frm.Name, frm.MenuBar
Next frm
End Sub

Oct 9 '06
21 10629
"MLH" <CR**@NorthStat e.netwrote
Hmm??? Trying to convert it to something
A97 understands. Not having much luck.
I modified 2 lines above...
Dim aob As Object
For Each aob In CurrentDB.AllFo rms
But am still getting compile-time errors.
Use your original approach, but omit the MenuBar (doesn't exist for a
document).

The name does exist, so use the name in a DoCmd.OpenForm to open the Form in
Design View, at which time there will be a valid Form available. Do
whatever it is you need to do with the Form open, then close it and move on
to the next one.

Don't get all carried away with trying to define it as Object. My
recollection is that AllForms was not included in Access 97, in any case.

Just a comment: when Access has told me that "property or method does not
exist," Access has always been correct -- either I have misspelled it, or I
am using it in a situation where it does not exist. I've done that enough
times that now I believe Access when it gives me that error message.

Larry Linson
Microsoft Access MVP


Oct 9 '06 #11
MLH <CR**@NorthStat e.netwrote in
news:nl******** *************** *********@4ax.c om:
Am having trouble with the following
snippet. It stops after only cycling thru
open forms. There are many more than
that. How to modify this to cycle thru
all forms?

Sub AllOpenForms()
Dim frm As Form
' Enumerate Forms collection.
For Each frm In Forms
' Print name of form.
Debug.Print frm.Name, frm.MenuBar
Next frm
End Sub
No one has given you the answer to this question, because you didn't
specify your version of Access.

A2K has the AllForms collection, which includes, well, all the
forms, open or closed.

A97 lacked that collection, so you had to use the Documents
collection.

What you want to look at is this collection:

CurrentDB.Conta iners!Forms.Doc uments

You can use it like this:

Dim doc As Document

For Each doc in CurrentDB.Conta iners!Forms.Doc uments
DoCmd.OpenForm doc.Name
Next
Set doc = Nothing

Certain properties don't exist until it's open and you have a choic
of views for opening it. If you want to change and save properties,
you'll need to open in design view.

Free clue: you'll get more useful answers if you'll clearly specify
that you're using A97 -- you're way behind the curve and people
shouldn't be expected, 9 years after the release of A2K, to post
code that works for both pre-A2K and for A2K and later.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Oct 10 '06 #12
MLH
<snip>
>Use your original approach, but omit the MenuBar (doesn't exist for a
document).

The name does exist, so use the name in a DoCmd.OpenForm to open the Form in
Design View, at which time there will be a valid Form available. Do
whatever it is you need to do with the Form open, then close it and move on
to the next one.

Don't get all carried away with trying to define it as Object. My
recollection is that AllForms was not included in Access 97, in any case.

Just a comment: when Access has told me that "property or method does not
exist," Access has always been correct -- either I have misspelled it, or I
am using it in a situation where it does not exist. I've done that enough
times that now I believe Access when it gives me that error message.

Larry Linson
Microsoft Access MVP
Perfect idea. Thx, Larry.
Oct 10 '06 #13
MLH
<snip>
>In order to display the menubar/toolbar I think the form needs to be
opened in design mode, hidden, to get that info.
Public Sub ShowAllFormsMen us()
Dim db As DAO.Database
Dim doc As Document
Set db = CurrentDb
Dim frm As Form

With db.Containers!F orms
For Each doc In .Documents
DoCmd.OpenForm doc.name, acDesign, , , , acHidden
Set frm = Forms(doc.name)
Debug.Print doc.name; Tab; "Menubar " & frm.MenuBar; Tab;
"Toolbar " & frm.Toolbar
DoCmd.Close acForm, doc.name
Set frm = Nothing
Next
End With
db.Close
Set db = Nothing
End Sub
Yep. That worked perfectly. Its what Larry Linson said a few
lines up. I was overlooking the important fact that these forms
needed to be opened in order to make useful reference to or
read their MenuBar property setting. Thanks for the snippet.
Worked perfect right out-a-the-box.
Oct 10 '06 #14
MLH
I appreciate you not charging me for the "free clue"

How many people would answer a post, I wonder,
sharing with the NG whether A97 is something they
use almost daily? I have no idea. I would be curious
to know. Maybe a hundred people will reply and we'll
all know. Maybe someone will analyze the last 5-yrs
posts to determine how many are A97 specific, how
many are specific to an advanced release and how
many are non-specific.
Oct 10 '06 #15

"MLH" <CR**@NorthStat e.netwrote in message
news:r1******** *************** *********@4ax.c om...
>I appreciate you not charging me for the "free clue"

How many people would answer a post, I wonder,
sharing with the NG whether A97 is something they
use almost daily? I have no idea. I would be curious
to know. Maybe a hundred people will reply and we'll
all know. Maybe someone will analyze the last 5-yrs
posts to determine how many are A97 specific, how
many are specific to an advanced release and how
many are non-specific.
I pretty much assume that most of us "Access 97 Bigots" who didn't like the
idea of leaping feet-first into Access 2000 SP nothing, have, by now, come
to terms. In fact, due to an installation glitch, I don't even have a
working copy of Access 97 on my production machine, and no clients still
using it, so no compelling need (other than nostalgia) to rush to correct
the problem. As of now, I use either Access 2002 or 2003... even though
they are the same file format, it's really a good idea to test with the
exact version that the users will have.

I could, I suppose, install Access 2000 with all the SPs, because that's
reasonably stabilized, but don't have any clients who are still using it,
either. Even that is "out of support."

Actually, one of the suggestions in the FAQ is that you mention the Access
version you are using when posting.
http://www.mvps.org/access/netiquette.htm. And, if it will get you the
correct answer, why not? There's certainly no "brand of shame" associated
with that version. Few do that, however.

Larry Linson
Microsoft Access MVP
Oct 10 '06 #16
Bri
MLH wrote:
I appreciate you not charging me for the "free clue"

How many people would answer a post, I wonder,
sharing with the NG whether A97 is something they
use almost daily? I have no idea. I would be curious
to know. Maybe a hundred people will reply and we'll
all know. Maybe someone will analyze the last 5-yrs
posts to determine how many are A97 specific, how
many are specific to an advanced release and how
many are non-specific.
I use AC97 for development 99% of the time and then convert up to the
clients version on installation. I never assume that the people here
will know that and always mention that I am using AC97 when I post a
question. It takes hardly any time to include that info (or any other
info that might be needed to clarify the problem).

--
Bri

Oct 10 '06 #17
Bri
Larry Linson wrote:
I pretty much assume that most of us "Access 97 Bigots" who didn't like the
idea of leaping feet-first into Access 2000 SP nothing, have, by now, come
to terms.
The help system alone is good enough reason for keeping AC97 around. I
am continually frustrated with the help systems of all of the post AC97
versions. IMNSHO, AC97 is still the sweet spot from the developers POV.

--
Bri

Oct 10 '06 #18
MLH <CR**@NorthStat e.netwrote in
news:r1******** *************** *********@4ax.c om:
I appreciate you not charging me for the "free clue"

How many people would answer a post, I wonder,
sharing with the NG whether A97 is something they
use almost daily? I have no idea. I would be curious
to know. Maybe a hundred people will reply and we'll
all know. Maybe someone will analyze the last 5-yrs
posts to determine how many are A97 specific, how
many are specific to an advanced release and how
many are non-specific.
I use A97 almost daily, as with A2K.

I don't use any of the later versions of Access, even though I have
Access 2K2 installed.

But if I were posting about a problem I was having in A97, I'd say
that my problem was in A97, since I know that most people in the
newsgroup are likely using A2K2 or A2K3.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Oct 10 '06 #19
Bri <no*@here.comwr ote in news:3pQWg.1192 91$1T2.13017@pd 7urf2no:
I use AC97 for development 99% of the time and then convert up to
the clients version on installation.
I used to do that, but there were too many things that work just
fine in A97 that break in A2K, so I now do all of my development for
A2K clients in A2K itself.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Oct 10 '06 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
1981
by: John Ortt | last post by:
Hi there, I have written the following code to colour cycle the background in one of my forms. The problem is it only cycles from Black to Red and then reverts back to Black. Does anyone have any idea what's causing this?
4
1781
by: sparks | last post by:
OK we have it so we can use tables to define skip patterns on our forms. BUT we can only do one form. Public Function skipPattern(currentFrm As Form, Optional currentCtl As Control = Null) As Integer the current form. ouch. this works fine as long as the controls are all on one form.
11
3560
by: DFS | last post by:
Architecture: Access 2003 client, Oracle 9i repository, no Access security in place, ODBC linked tables. 100 or so users, in 3 or 4 groups (Oracle roles actually): Admins, Updaters and ReadOnly. Each group sees a different set of menu options when they open the client and login to Oracle. For the sake of speed I use pass-through queries here and there for updates and deletes. I update their SQL property in code and execute them.
1
988
by: Paul W | last post by:
If I hit F5 from VS without making any previous changes to the project, it appears on screen in 4 seconds. If I make any minor change to the project before hitting F5 it takes 20+ seconds. This is currently a small project (2 forms). This gets very old very quickly during a debugging session. Is there anything that can be done to reduce this time? Thanks, Paul.
2
1394
by: Dean Slindee | last post by:
Is there any way to refer to the .text property of a status bar panel thru object syntax, like below (the inner "for" does not work): Public Function FormStatusBarPaint(ByVal frm As Form) As Integer Dim obj As New Control
1
2243
by: sranney | last post by:
Hey all, I'm trying to get access (through VBA) to cycle through all the records in a form and perform a task for each one that has something in a text box. I think I know how to get it to do what I want, I just don't know how to reference a record in my For each... statement. Here is the code I have: Dim Record As Recordset For Each Record In Forms!frmRFIattach If Not Forms!frmRFIattach!Attachment = "" Then ...
2
5064
by: ckerns | last post by:
I have a page with a bunch of drop down boxes. They are named: MonEquipAMWk1 MonEquipPMWk1 thru FriEquipAMWk1 FriEquipPMWk1
2
1444
by: User | last post by:
Hi, How to go about iterating thru all the text box in a form? Any pointers or reference i can read up on? Thanks
10
2088
by: fdu.xiaojf | last post by:
Hi all, I have the following code: for i in generator_a: # the first "for" cycle for j in generator_b: if something_happen: # do something here ..., I want the outer cycle to break break
0
8676
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8608
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9164
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7734
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6524
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.