Results 1 to 7 of 7
  1. #1
    uoghk is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    149

    how to set application title & logo in code?

    how to set application title & logo in code?


    thanks

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Review this first result from my Bing search https://www.vishalon.net/blog/change...icon-using-vba
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    To add to June7's link this is what I use to update the version number and revision date in the db title:
    Code:
    VPrivate Sub Form_BeforeUpdate(Cancel As Integer)
        If MsgBox("Do you want to change the version number?" & Chr(13) & _
                  "This should only be done by the Developer or the Super User...", vbCritical + vbYesNo, "Confirm version change!") = vbNo Then
              Me.Undo
        End If
        'update the startup
        
        SetApplicationTitle ("YourDatabase Version " & Me.CurrentVersion & " Revised " & Format(Nz(Me.ChangeDate, Date), "dd-mmm-yyyy"))
    End Sub
    Function SetApplicationTitle(ByVal MyTitle As String)
       If SetStartupProperty("AppTitle", dbText, MyTitle) Then
          Application.RefreshTitleBar
       Else
          MsgBox "ERROR: Could not set Application Title"
       End If
    End Function
    
    
    Function SetStartupProperty(prpName As String, _
          prpType As Variant, prpValue As Variant) As Integer
       Dim db As DAO.Database, PRP As DAO.Property, WS As Workspace
       Const ERROR_PROPNOTFOUND = 3270
    
    
       Set db = CurrentDb()
    
    
       ' Set the startup property value.
       On Error GoTo Err_SetStartupProperty
       db.Properties(prpName) = prpValue
       SetStartupProperty = True
    
    
    Bye_SetStartupProperty:
       Exit Function
    
    
    Err_SetStartupProperty:
       Select Case Err
       ' If the property does not exist, create it and try again.
       Case ERROR_PROPNOTFOUND
          Set PRP = db.CreateProperty(prpName, prpType, prpValue)
          db.Properties.Append PRP
          Resume
       Case Else
          SetStartupProperty = False
          Resume Bye_SetStartupProperty
       End Select
    End Function
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  4. #4
    uoghk is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    149
    Quote Originally Posted by June7 View Post
    Review this first result from my Bing search https://www.vishalon.net/blog/change...icon-using-vba
    I copy the coding from the link.
    But it shows runtime error
    Click image for larger version. 

Name:	error3270.png 
Views:	14 
Size:	13.7 KB 
ID:	48834

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    That's unfortunate. I tried some of the other properties and they are available. Apparently, AppTitle and AppIcon need special handling.

    Review https://stackoverflow.com/questions/...ties-not-found
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    uoghk is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    149
    Thanks June7 & Gicu

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,860
    Would it not be easier to set them in Options, even dummy entries, then they would exist when they needed to be changed?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 04-06-2022, 09:22 AM
  2. Code VBA for minimize application in Taskbar (Access)
    By ZakariaAadel in forum Programming
    Replies: 1
    Last Post: 11-14-2020, 07:38 AM
  3. Replies: 1
    Last Post: 07-07-2016, 02:34 AM
  4. Replies: 2
    Last Post: 03-20-2015, 06:30 AM
  5. Change chart title with code
    By Pastor Del in forum Reports
    Replies: 6
    Last Post: 02-11-2014, 08:56 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums