Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change .caption property in a sub-form ?

Status
Not open for further replies.

Berny33

Programmer
Apr 20, 2001
6
0
0
CA
Good morning.....

I have made a multilingual database with MS-Access 2000 where i change form labels caption info (from english to french or english to spanish) depending on a user language preference. I use the form's ON OPEN event (works also with ON LOAD event) to modify the labels on the main form but the trick does not work on the subform! I am always getting a "Can't fin form..." error message.

Would someone have another bunny in his hat ???

Berny33 :cool:
 
In the same code that you created for "on load" event of the main form set focus on the subform (Forms![mainform]![subform].SetFocus). Than refer to the control's caption property from the subform like:
Forms![mainform]![subform]![Control].Caption
You can write this in the same code, after the SetFocus line, or you can assign this on an event of the subform (like "on enter").
After you finish changing the captions, move the focus back in the main form, on the exact control that you want (Forms![mainform]![control].SetFocus)

I hope you understand what I am trying to explain :)
 
It is not necessary to set the focus. Merely assign the Caption property.

lblTest.Caption = "Whatever you want"

Steve King Growth follows a healthy professional curiosity
 
Thank you Simco for your quick response but i'm still getting the same kind of message. It's like if the subform if never brought up to screen fast enough and Access can not find it. So no matter if the lines code are within the main form or the subform, it just does not want to change the caption. I have tried focussing on the subform also but no luck...

There must be a specific time or event that is right to do this !

Berny33
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top