473,386 Members | 1,827 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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
7 1262
ADezii
8,834 Expert 8TB
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
3,532 Expert 2GB
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
3,532 Expert 2GB
We gotta stop stumbling over each other like this, ADezii!

Linq ;0)>
Aug 2 '07 #4
ADezii
8,834 Expert 8TB
We gotta stop stumbling over each other like this, ADezii!

Linq ;0)>
Great minds think alike!
Aug 3 '07 #5
Um, you guys are totally my heroes right now.
Aug 3 '07 #6
imrosie
222 100+
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
3,532 Expert 2GB
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

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

Similar topics

1
by: G Kannan | last post by:
Hey all! I have written a perl script to retrieve information from a HTML Form and insert the data into an Oracle database table. I am gettting the the following error message: "Use of...
16
by: cwizard | last post by:
I'm calling on a function from within this form, and there are values set but every time it gets called I get slammed with a run time error... document.frmKitAmount.txtTotalKitValue is null or not...
4
by: Jack | last post by:
Hi, I have a checkbox the value which goes to a database via a asp page that builds the sql string. In the front end asp page, the checkbox code is written as follows: <i><input...
3
by: francisco lopez | last post by:
I hope not sent I twice. ok here is my problem, the javascript form validation works perfect during I put a emaildirection in the <form action:""> comand, like this: <form...
4
by: mitch-co2 | last post by:
What I am trying to do is when someone clicks on the YES radio button I want the text field called MYTEXT to equal the text field named DATE. The below code works as long as I do NOT UN-COMMENT...
4
by: Magnus Blomberg | last post by:
Hello! I have a problem when using a hidden field to send a value to the server. Below you can see my code in simplyfied versions. What I'm trying to do is: 1. The user browses for a picture...
4
by: Mangler | last post by:
Without writing a bible on what I'm trying to do I'll see if someone can answer a quick question. I have a form that the user writes a value in a test field. I need to put a hidden value that...
4
by: AR123 | last post by:
In the field for employee contribution I want to have GBP and make sure that this prints out in the results email. How can I set it up so that the GBP display next to the value in the results email?...
10
by: Kelly | last post by:
Can anyone tell me what I'm doing wrong here? ================================== <html> <head> <title>Test Form</title> <script language="JavaScript" type="text/javascript"> </head>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.