me.visible doesn't work

  • Thread starter Bill Reed via AccessMonster.com
  • Start date
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.
 
B

Bill Reed via AccessMonster.com

Thanks a million. What's the explanation for this? It didn't seem to
generate an error when I stepped through it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top