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
- 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
- Forms!FormName!SubformName.Form!ControlNameOnMySubform
-
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 :)