Form's Caption shows Current Record

M

Mike Janes

How can I make the form's caption (the title bar) display a field (or
fields) of the Current Record?

For example, I would like to have a person's name show up in the Title
Bar when his/her record is displayed in the form.
 
D

Dirk Goldgar

Mike Janes said:
How can I make the form's caption (the title bar) display a field (or
fields) of the Current Record?

For example, I would like to have a person's name show up in the Title
Bar when his/her record is displayed in the form.

Use the form's Current event to set the form's Caption property. For
example:

'----- start of example code -----
Private Sub Form_Current()

If Me.NewRecord Then
Me.Caption = "(new record)"
Else
Me.Caption = _
"Employee " & Me.EmployeeID & ": " & _
(Me.FirstName + " ") & _
(Me.MiddleName + " ") & _
Me.LastName
End If

End Sub
'----- end of example code -----
 

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