dynamically change form caption

Posted on 2011-04-19
Last Modified: 2012-08-14
Hi Experts

I have large number of forms and would like to change their caption through code

Question by:drivers
    LVL 119

    Expert Comment

    by:Rey Obrero
    you can use this in a load event of the form


    LVL 1

    Author Comment

    Sorry if I wasn't clear
    let me explain I would like to change all Form caption in mdb through one shot?
    LVL 75

    Expert Comment

    by:DatabaseMX (Joe Anderson - Access MVP)
    The same caption on all forms ?

    LVL 23

    Accepted Solution

    - the following is a code in VBA.
    - it will display all form caption in this format <FormName : My Standard Caption>'. you can change the stdCaption to any title value that you required:

    Const stdCaption = " : My Standard Caption"

    Sub FormCaption()
    Dim allfrm As Object
    For Each allfrm In CurrentProject.AllForms
        DoCmd.OpenForm allfrm.Name, acDesign
        Forms(allfrm.Name).Caption = allfrm.Name & stdCaption
        DoCmd.Close acForm, allfrm.Name, acSaveYes
    End Sub
    LVL 1

    Author Comment

    Thanks everyone
    OP Zaharin solution worked.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
    This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
    In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now