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 21 10602
MLH wrote:
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
Use the Documents collection.
I tried the following approach FIRST. But it does
not understand the MenuBar, complaining that
the Method or data member not found. So that's
why I tried the other approach.
Private Sub Command0_Click( )
Dim DefaultWorkspac e As Workspace
Dim CurrentDatabase As Database
Dim MyContainer As Container, MyDocument As Document, HowManyForms
As Integer
Dim i As Integer
Set DefaultWorkspac e = DBEngine.Worksp aces(0)
Set CurrentDatabase = DefaultWorkspac e.Databases(0)
Set MyContainer = CurrentDatabase .Containers(1)
HowManyForms = MyContainer.Doc uments.Count
For i = 0 To MyContainer.Doc uments.Count - 1
Set MyDocument = MyContainer.Doc uments(i)
Debug.Print MyDocument.Name , MyDocument.Menu Bar
Next i
End Sub
Greetings, try this:
Sub checkAllForms()
Dim aob As AccessObject
Dim boolResult As Boolean
For Each aob In CurrentProject. AllForms
Debug.Print aob.Name
Next aob
End Sub
this code will list all the forms in your application open or closed
Rich
*** Sent via Developersdex http://www.developersdex.com ***
On Mon, 09 Oct 2006 12:08:56 -0400, MLH wrote:
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
Public Sub ShowAllForms()
Dim db As DAO.Database
Dim cnt As Container
Dim doc As Document
Set db = CurrentDb
For Each cnt In db.Containers
If cnt.Name = "Forms" Then
For Each doc In cnt.Documents
Debug.Print doc.Name
Next doc
End If
Next cnt
End Sub
Change If cnt.Name = "Forms" Then to
If cnt.Name = "Reports" Then
of
If cnt.Name = "Tables" Then
etc. to show the other container objects.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
On 09 Oct 2006 16:26:55 GMT, Rich P <rp*****@aol.co mwrote:
>Sub checkAllForms()
Dim aob As AccessObject
Dim boolResult As Boolean
For Each aob In CurrentProject. AllForms
Debug.Print aob.Name
Next aob End Sub
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.
On Mon, 9 Oct 2006 09:32:03 -0700, fredg <fg******@examp le.invalid>
wrote:
>
Public Sub ShowAllForms() Dim db As DAO.Database Dim cnt As Container Dim doc As Document Set db = CurrentDb
For Each cnt In db.Containers
If cnt.Name = "Forms" Then
For Each doc In cnt.Documents
Debug.Print doc.Name
Next doc
End If Next cnt End Sub
Change If cnt.Name = "Forms" Then to If cnt.Name = "Reports" Then of If cnt.Name = "Tables" Then etc. to show the other container objects.
Thanks. Seems close, but this does not work either...
Public Sub ShowAllForms()
Dim db As DAO.Database
Dim cnt As Container
Dim doc As Document
Set db = CurrentDb
For Each cnt In db.Containers
If cnt.Name = "Forms" Then
For Each doc In cnt.Documents
Debug.Print doc.Name, doc.MenuBar
Next doc
End If
Next cnt
End Sub
Just can't seem to get it to read the MenuBar property.
MLH wrote:
I tried the following approach FIRST. But it does
not understand the MenuBar, complaining that
The other responses are probably fine, but the approach I've taken,
which seems to work when I've had need to do what you're doing (in my
case, I wanted to count all lines of code in my apps), is to use the
MSysObjects table.
For forms:
Select MSysObjects!Nam e as ModName from MSysObjects where
MSysObjects!Typ e = -32768
For reports:
Select MSysObjects!Nam e as ModName from MSysObjects where
MSysObjects!Typ e = -32764
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
fredg wrote:
On Mon, 09 Oct 2006 12:08:56 -0400, MLH wrote:
>>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
Public Sub ShowAllForms()
Dim db As DAO.Database
Dim cnt As Container
Dim doc As Document
Set db = CurrentDb
For Each cnt In db.Containers
If cnt.Name = "Forms" Then
For Each doc In cnt.Documents
Debug.Print doc.Name
Next doc
End If
Next cnt
End Sub
Change If cnt.Name = "Forms" Then to
If cnt.Name = "Reports" Then
of
If cnt.Name = "Tables" Then
etc. to show the other container objects.
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
MLH wrote:
Thanks. Seems close, but this does not work either...
Public Sub ShowAllForms()
Dim db As DAO.Database
Dim cnt As Container
Dim doc As Document
Set db = CurrentDb
For Each cnt In db.Containers
If cnt.Name = "Forms" Then
For Each doc In cnt.Documents
Debug.Print doc.Name, doc.MenuBar
Next doc
End If
Next cnt
End Sub
Just can't seem to get it to read the MenuBar property.
Because there is none. A document in the container
Container!Forms is _not_ a Form object.
Surprised? Check the help file and the object model.
AllForms was introduced after A97 to solve the
inconvenience you encountered. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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?
|
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.
|
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...
|
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...
|
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
| |
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...
|
by: ckerns |
last post by:
I have a page with a bunch of drop down boxes. They are named:
MonEquipAMWk1
MonEquipPMWk1
thru
FriEquipAMWk1
FriEquipPMWk1
|
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
|
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
|
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...
|
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...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |