CurrentDb.Properties("AppTitle") , application.name

Pauldohert

Something in here
Local time
Today, 09:02
Joined
Apr 6, 2004
Messages
2,101
I have an app, which I think used to work with application.name returning what has been entered as the application title in the startup options.

Now however it seems to just return MS Access.

Is Application.name correct? Or has it ever been?


Thanks
 
Straight from my splash form.... A2000

Option Compare Database
Option Explicit

Private Sub Form_Load()
Dim intX As Integer
Dim s As String

DoCmd.ShowToolbar "Form View", acToolbarNo
DoCmd.ShowToolbar "Print Preview", acToolbarNo

s = Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name))) & "\KQ.ico"
Const DB_Text As Long = 10
intX = AddAppProperty("AppTitle", DB_Text, " Jewellery Manager")
intX = AddAppProperty("AppIcon", DB_Text, s)
Application.RefreshTitleBar

End Sub

Function AddAppProperty(strName As String, varType As Variant, varValue As Variant) As Integer
Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270

Set dbs = CurrentDb
On Error GoTo AddProp_Err
dbs.Properties(strName) = varValue
AddAppProperty = True

AddProp_Bye:
Exit Function

AddProp_Err:
If Err = conPropNotFoundError Then
Set prp = dbs.CreateProperty(strName, varType, varValue)
dbs.Properties.Append prp
Resume
Else
AddAppProperty = False
Resume AddProp_Bye
End If

End Function

Private Sub Form_Timer()
On Error GoTo Err_Form_Timer

DoCmd.OpenForm "frmMainMenu"
DoCmd.Close acForm, Me.Name

Exit_Form_Timer:
Exit Sub

Err_Form_Timer:
MsgBox Err.Description, , " Jewellery Manager"
Resume Exit_Form_Timer

End Sub


Dave
 
I am guessing you are saying application.name was never correct, I am sure I have seen it working in thge past, but doesn't seem to now.
 
CurrentDb.Properties("AppTitle") ,application.name

Oldsoftboss,

Have used your code, worked well, thank you.

Do you know how to put a value from a table(s) in the title string??

Thanks

Dan
 
Replace this line

intX = AddAppProperty("AppTitle", DB_Text, " Jewellery Manager")

with a Dlookup

Dim strTitle as string
strTitle = DLookup("ApplicationTitle", "TableName", "TableID = 1")
intX = AddAppProperty("AppTitle", DB_Text, strTitle)

This assumes you have a table with only one record, and an AutoNo ID field
Just replace the table name etc to suit.

Dave
 
Dave,

Thanks a lot, i changed it to suit and it works great. Is the way i have done it OK for access rules of good practice??

Once this is written correctly, i think it would be a great thing for you to put in the sample code area for others to use, as i could not find anything to help me do this.

CODE:
Dim intX As Integer
Dim s As String
Dim strTitleName As String
Dim strTitleCompany As String
Dim strTitleHyphen As String
Dim strTitleRegText As String

s = Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name))) & "\main.ico"
Const DB_Text As Long = 10
strTitleHyphen = (" - ")
strTitleRegText = ("Registered to ")
strTitleName = DLookup("SoftwareName", "tblSoftwareInformation")
strTitleCompany = DLookup("CompanyName", "tblCompanyInformation")
intX = AddAppProperty("AppTitle", DB_Text, strTitleName & strTitleHyphen & strTitleRegText & strTitleCompany)
intX = AddAppProperty("AppIcon", DB_Text, s)
Application.RefreshTitleBar


Thanks Dan
 
Makes it readily adaptable to each Db you create.
Well done, glad to help,

Dave
 

Users who are viewing this thread

Back
Top Bottom