By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,224 Members | 1,143 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,224 IT Pros & Developers. It's quick & easy.

turning the value of a field into the title of a form

P: 9
Hi all,

When I'm cycling through separate records, I want to see the title of the form change depending on the record. Specifically, I want two field values to show up.

i.e. if there is a field "Name" and a field "Age", when I cycle through different records in form view, i want the title of the form window to be "James 23" for one record, and "Jane 56" for another.

Can this be done? I'm familiar with going to properties/format/caption for the form name, and wondered if there is a command that can be entered there.

Thanks!
Aug 2 '07 #1
Share this Question
Share on Google+
7 Replies


ADezii
Expert 5K+
P: 8,669
Hi all,

When I'm cycling through separate records, I want to see the title of the form change depending on the record. Specifically, I want two field values to show up.

i.e. if there is a field "Name" and a field "Age", when I cycle through different records in form view, i want the title of the form window to be "James 23" for one record, and "Jane 56" for another.

Can this be done? I'm familiar with going to properties/format/caption for the form name, and wondered if there is a command that can be entered there.

Thanks!
It can be done very easily, in the Current() Event of your Form, place the following code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. 'Only display Name and Age in the Form Caption if both values are present
  3. If Not IsNull(Me![Name]) And Not IsNull(Me![Age]) Then
  4.   Me.Caption = Me![Name] & " " & Me![Age]
  5. Else
  6.   Me.Caption = "Some Generic Caption"
  7. End If
  8. End Sub
Aug 2 '07 #2

missinglinq
Expert 2.5K+
P: 3,532
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.     Me.Caption = "Record for:   " & NameField & "  Age:  " &  AgeField
  3. End Sub
Aug 2 '07 #3

missinglinq
Expert 2.5K+
P: 3,532
We gotta stop stumbling over each other like this, ADezii!

Linq ;0)>
Aug 2 '07 #4

ADezii
Expert 5K+
P: 8,669
We gotta stop stumbling over each other like this, ADezii!

Linq ;0)>
Great minds think alike!
Aug 3 '07 #5

P: 9
Um, you guys are totally my heroes right now.
Aug 3 '07 #6

imrosie
100+
P: 222
Um, you guys are totally my heroes right now.
Wow, my heroes too.

I was just about to ask a queston on this in the Access Forum and stumbled upon this information. Thanks!

Rosie
Aug 6 '07 #7

missinglinq
Expert 2.5K+
P: 3,532
That's why it really is important to run a search here before posting a question! Those of us here who answer questions on a regular basis do so because we enjoy programming and enjoy teaching others how to program, but it's becomes very tiresome after you've answered the same question for the twentieth time!

Have a great day, Rosie!

Linq ;0)>
Aug 6 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.