Home Page
Policies
Policies
About
Tips And Tricks
Helpful Links
e-mail me

Picture of building from outside Tips And Tricks

I seem to run into things from time to time that I want to share with the world, usually things that I had to find out the hard way. Sometimes it will just be something that I had to dig for, and want to make more readily accessible. This page is intended to make life a little easier for other programmers. If it meets your need, then that's what it's here for.



Change Title Of ADP Programmatically (using code)
Here is a function to change the title of an ADP in MS Access. It was written in MS Access 2000, and also seems to run in MS Access 2003. When I did the research on this issue, I found examples of how to change the title on an MDB, but not much on how to change it for an ADP. I ended up having to figure it out by trial and error. Maybe you won't have to.
'this is the working version -BWM 09-29-06
'corrected a problem with zero-length title -BWM 10-06-06
Sub ChgADPTitle(vNewTitle)

 Const conPropNotFoundError = 2455
 Dim strCurrentTitle As String

 On Error GoTo ErrorHandler
 'Debug.Print CurrentProject.Properties("AppTitle")
 strCurrentTitle = CurrentProject.Properties("AppTitle") 'retrieve or gen error -BWM 09-29-06
 If Len(Trim(strCurrentTitle)) > 0 Or Len(Trim(strCurrentTitle)) = 0 Then
  CurrentProject.Properties.Remove "AppTitle"
  CurrentProject.Properties.Add "AppTitle", vNewTitle
 End If
 Application.RefreshTitleBar 'make sure that it shows up immediately
 Exit Sub

ErrorHandler:
 If Err.Number = conPropNotFoundError Then
  CurrentProject.Properties.Add "AppTitle", vNewTitle
 Else
  MsgBox "Error #" & Err.Number & ": " & Err.Description
 End If
 Resume Next
End Sub

If you found this information to be useful, and would like to donate via PayPal to help offset the cost of maintaining this web site, use the following button:



|Home Page| |Custom Software| |Policies| |About| |Tips And Tricks| |Helpful Links|