Access Form's Caption to display info from a text box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Greetings!

I am working on a Microsoft Access form and I was wondering if it was
possible to fix the caption of this form to display the text that is
contained within one of the text boxes on this same form? Did I say this
right? :-)

Scenario..
A user opens this form and enters the text "Susan Anthony" in the first text
box. This text box's name is "PBRNName". After the user either tabs or
selects the next text box or whatever comes next afterwards, the form's
caption, located on the top left corner changes to "Susan Anthony's
Evaluation Data Entry From" or whatever.

Can this be done? I was reading some of the other bulletins and I get the
feeling that it can be done but would require some programming.

Any help you can offer would greatly be appreciated!! :-)

Thank you so much!

Sincerely,

Leonard Wayne Peacock
 
Use the AfterUpdate event of the text box and the Current event of the form
to set the form's Caption

Private Sub PBRNName_AfterUpdate()
Me.Caption = Me.PBRNName
End Sub

Private Sub Form_Current()
Call PBRNName_AfterUpdate
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
news:[email protected]...
 
In design view, select the text box and in the Events tab of the property
sheet, select "After Update" and choose [Event Procedure], then click on the
"..." to build the code. Paste the following code and see if it works (I'm
just typing here and I haven't tested it):

If Not IsNull(Me.PBRNName) Then
Me.Caption=Me.PBRNName & "'s Evaluation Data Entry Form"
Else
Me.Caption="Evaluation Data Entry Form"
End If

You can also paste it into the form's "On Current" event, so the form's
caption will change if you scroll through the records.
 
Mark,

Thanks for the helpful advice! The code that you provided worked without
any errors. :-)

Sincerely,

Leonard Wayne Peacock

Mark said:
In design view, select the text box and in the Events tab of the property
sheet, select "After Update" and choose [Event Procedure], then click on the
"..." to build the code. Paste the following code and see if it works (I'm
just typing here and I haven't tested it):

If Not IsNull(Me.PBRNName) Then
Me.Caption=Me.PBRNName & "'s Evaluation Data Entry Form"
Else
Me.Caption="Evaluation Data Entry Form"
End If

You can also paste it into the form's "On Current" event, so the form's
caption will change if you scroll through the records.

Leonard Peacock said:
Greetings!

I am working on a Microsoft Access form and I was wondering if it was
possible to fix the caption of this form to display the text that is
contained within one of the text boxes on this same form? Did I say this
right? :-)

Scenario..
A user opens this form and enters the text "Susan Anthony" in the first
text
box. This text box's name is "PBRNName". After the user either tabs or
selects the next text box or whatever comes next afterwards, the form's
caption, located on the top left corner changes to "Susan Anthony's
Evaluation Data Entry From" or whatever.

Can this be done? I was reading some of the other bulletins and I get the
feeling that it can be done but would require some programming.

Any help you can offer would greatly be appreciated!! :-)

Thank you so much!

Sincerely,

Leonard Wayne Peacock
 
Back
Top