Click to See Complete Forum and Search --> : Set caption of all forms?
ben1523
May 24th, 2003, 08:31 AM
I know in VB you can cycle through all the forms but in VBA the same code does not work (surprise surprise), does anyone have the code to go through all forms, I suppose it is just a few lines as with VB but I just can find out how to do it (this is to set the caption of all the forms).
Any help greatly apprieciated
Ephesians
May 28th, 2003, 12:51 PM
This should do what you want in Access:
Public Sub ChangeCaption()
'_______________________________________________________________
'Change the caption of every form.
'_______________________________________________________________
Dim docTemp As Document
Dim conTemp As Container
Dim frmTemp As Form
Dim dbase As Database
Set dbase = CurrentDb
Set conTemp = dbase.Containers!FORMS
For Each docTemp In conTemp.Documents
DoCmd.OpenForm docTemp.Name, acDesign, , , , acHidden
docTemp.Caption = "Whatever"
DoCmd.Close acForm, docTemp.Name, acSaveYes
Next
End Sub
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.