Form Caption Question

mcgooie

Registered User.
Local time
Today, 03:44
Joined
Sep 12, 2006
Messages
11
Dont know if its possible but no harm in asking.

Can the caption for a form be set to the value of a text box i.e. "Text10" for example?

cheers
 
Have been trying to make the caption at the top of my forms to display information from the data being displayed in the form i.e. Company name and point of contact. In this instance it could read "ABC Company - John Smith".

I searched for a similar thread and come across an answer to a similar question as

Uncle Gizmo said:
Yes!

me.Caption = me.txtYourTextBox

however, when i try this answer all i am shown in the form caption is essentially what i place in the Form Properties/Caption field. Can anybody tell me where i am going wrong please.

Much appreciated

Alan
 
You need to put the code in the forms OnOpen event.

Me.Caption = TextBox10
 
Thanks for your response, however that doesn't update as i go through the records. I added similar code to the forms OnCurrent event which although it updates the caption as i navigate through the records it shows the information in square brackets i.e. [ABC Company Ltd]. Any ideas on how to display only the data and not the [...] brackets please?

Regards

Alan
 
I would check your code again - you must have formatted the caption with the square brackets, or maybe they are in the text box. You can set the caption to anything, as you have seen.
 
gemma-the-husky said:
I would check your code again - you must have formatted the caption with the square brackets, or maybe they are in the text box. You can set the caption to anything, as you have seen.

Nope - not a square bracket to be seen anywhere?

I know it can be done since i have seen it on other databases and while it doesn't make that much difference it looks better without the [...] - any further suggestions / help appreciated.

Alan
 
The replies you received are correct and here is a sample to confirm it.

With the sample you may be able to see where you have gone wrong.

In my sample I have combined both Customer Name and CustomerID. The code is in the OnCurrent Event of the form.

Hope this helps sort it out.
 
Last edited:
i accept that the code provided in previous replies is correct since i tried it in a different database and it worked fine!! I will have to have a good look at the first database i used the coding in.

In the meantime, many thanks to everybody who took the time and trouble to offer advice - much appreciated.

Alan
 
Alan,

Do you have the form with the caption maximised??? If so then the form caption is wrapped in [ ] brackets.

Thanks

Dan
 
Dan,

Will have to check, don't have the particular database with me at the moment. Will let you know what happens.

Many Thanks

Alan
 

Users who are viewing this thread

Back
Top Bottom