B
Bill Reed via AccessMonster.com
I have the following code in the Open event of a form:
Private Sub Form_Open(Cancel As Integer)
Dim obj As Object
Dim dbs As Database
Dim strPath As String
On Error GoTo ErrorHandler
Set dbs = CurrentDb
With dbs
strPath = .Name
' Change title bar.
.Properties!AppTitle = strPath
' Update title bar on screen.
Application.RefreshTitleBar
End With
Me.Visible = False
Exit Sub
ErrorHandler:
If Err.Number = conPropNotFoundError Then
Set obj = dbs.CreateProperty("AppTitle", dbText, strPath)
dbs.Properties.Append obj
Else
MsgBox "Error: " & Err.Number & vbCrLf & Err.Description
End If
Resume Next
End Sub
The form opens on startup. When I step through the code, the form obeys the
me.visible = true line. When it runs automatically, it doesn't.
Private Sub Form_Open(Cancel As Integer)
Dim obj As Object
Dim dbs As Database
Dim strPath As String
On Error GoTo ErrorHandler
Set dbs = CurrentDb
With dbs
strPath = .Name
' Change title bar.
.Properties!AppTitle = strPath
' Update title bar on screen.
Application.RefreshTitleBar
End With
Me.Visible = False
Exit Sub
ErrorHandler:
If Err.Number = conPropNotFoundError Then
Set obj = dbs.CreateProperty("AppTitle", dbText, strPath)
dbs.Properties.Append obj
Else
MsgBox "Error: " & Err.Number & vbCrLf & Err.Description
End If
Resume Next
End Sub
The form opens on startup. When I step through the code, the form obeys the
me.visible = true line. When it runs automatically, it doesn't.