Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Where's my Caption? (2003)

    In Excel I can just use Application.Caption = "blah". How can I set the Caption in Access? I know Tools/ StartUp allows this, but I want to do it programmatically.

    Thanks, Andy.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 18 Times in 18 Posts

    Re: Where's my Caption? (2003)

    You can use the following procedure. It requires a reference to the Microsoft DAO 3.6 Object Library.

    Sub SetAppTitle(strTitle As String)
    Dim dbs As DAO.Database
    Dim prp As DAO.Property
    On Error GoTo ErrHandler
    Set dbs = CurrentDb
    Set prp = dbs.Properties("AppTitle")
    prp.Value = strTitle
    RefreshTitleBar
    ExitHandler:
    Set prp = Nothing
    Set dbs = Nothing
    Exit Sub
    ErrHandler:
    If Err = 3270 Then
    Set prp = dbs.CreateProperty("AppTitle", dbText, strTitle)
    dbs.Properties.Append prp
    Resume Next
    Else
    MsgBox Err.Description, vbExclamation
    Resume ExitHandler
    End If
    End Sub

    Call the procedure like this to set the application title (caption) to "Andy":

    SetAppTitle "Andy"

  3. #3
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Where's my Caption? (2003)

    Thank you very much. I thought it would be something straightforward..

    Thanks Andy.

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,537
    Thanks
    0
    Thanked 23 Times in 23 Posts

    Re: Where's my Caption? (2003)

    Hi Hans,
    Where is dbText defined (used in the CreateProperty command) and what is it used for?

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Where's my Caption? (2003)

    Patt

    Look in Help for DAO Constants.

    It just means that the Apptilte property takes a piece of Text.
    Regards
    John



  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,537
    Thanks
    0
    Thanked 23 Times in 23 Posts

    Re: Where's my Caption? (2003)

    Sorry i should have let you know i found some code hours ago that does the trick.

Posting Permissions

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