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

greet user HELP

P: 38
Hi there!

I'm new in coding a vb in ms access and I seemed to be lost.
my problem is I want to pass a value from FormA to FormB using a textbox, cmdButton and label control I seemed to get an error in access 2000.

hereis the code:
in Form A I have a txtLogin and I put this code in the Control Source:
=[FormA].[Forms]![lblName].[Caption]

then on FormB I have a lblName and I put this code:
=[FormB].[Forms]![txtLogin].[Value]

when the cmdButton is clicked the value of the txtLogin will be transfered to
lblName. unfortunately I'm missing something here :( can somebody help me and show me how to work on this functions!
thanks!
Jan 30 '08 #1
Share this Question
Share on Google+
3 Replies


Jim Doherty
Expert 100+
P: 897
Hi there!

I'm new in coding a vb in ms access and I seemed to be lost.
my problem is I want to pass a value from FormA to FormB using a textbox, cmdButton and label control I seemed to get an error in access 2000.

hereis the code:
in Form A I have a txtLogin and I put this code in the Control Source:
=[FormA].[Forms]![lblName].[Caption]

then on FormB I have a lblName and I put this code:
=[FormB].[Forms]![txtLogin].[Value]

when the cmdButton is clicked the value of the txtLogin will be transfered to
lblName. unfortunately I'm missing something here :( can somebody help me and show me how to work on this functions!
thanks!
You cannot place =[FormB].[Forms]![txtLogin].[Value] into a label you have to set the labels caption property

in the code for the command button in formA after the codeline that opens your formB type this line and provided our form B opens successfully the caption will be set by reference to the value of the txtLogin control on FormA

Expand|Select|Wrap|Line Numbers
  1.  Forms!FormB!lblName.caption=Forms!FormA!txtLogin
Look closely how you refer to the hierarchy of controls in Access starting at form level ie Forms!MyForm!MyControl shows a kind of snakepath if you understand me from the form to the eventual control

Expand|Select|Wrap|Line Numbers
  1.  Forms!FormName!SubformName.Form!ControlNameOnMySubform
  2.  
snakes right down to the control on a subform mounted on a form and so it goes on (remove any gap in the last code line above my post refuses to format it properly :(

Hopes his helps you a little and welcome to 'both' vba coding and the scripts!

Regards

Jim :)
Jan 30 '08 #2

P: 38
Thank you Jim! for helping me and clearing it out for me, the code really helps.
I'll keep in mind about what you suggested and practice on it more.
Jan 30 '08 #3

Jim Doherty
Expert 100+
P: 897
Thank you Jim! for helping me and clearing it out for me, the code really helps.
I'll keep in mind about what you suggested and practice on it more.
Glad to be of help to you

Jim :)
Jan 30 '08 #4

Post your reply

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