Results 1 to 2 of 2

Thread: Set caption of all forms?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2001
    Posts
    153

    Set caption of all forms?

    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
    Keyboard Error

    Press F1 to resume

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Posts
    424
    This should do what you want in Access:
    VB Code:
    1. Public Sub ChangeCaption()
    2. '_______________________________________________________________
    3. 'Change the caption of every form.
    4. '_______________________________________________________________
    5.      Dim docTemp As Document
    6.      Dim conTemp As Container
    7.      Dim frmTemp As Form
    8.      Dim dbase As Database
    9.      Set dbase = CurrentDb
    10.      Set conTemp = dbase.Containers!FORMS
    11.      For Each docTemp In conTemp.Documents
    12.           DoCmd.OpenForm docTemp.Name, acDesign, , , , acHidden
    13.           docTemp.Caption = "Whatever"
    14.           DoCmd.Close acForm, docTemp.Name, acSaveYes
    15.      Next
    16. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width