greet user HELP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cephal0n
    New Member
    • Jan 2008
    • 38

    greet user HELP

    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!
  • Jim Doherty
    Recognized Expert Contributor
    • Aug 2007
    • 897

    #2
    Originally posted by cephal0n
    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

    Code:
     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!My Control shows a kind of snakepath if you understand me from the form to the eventual control

    Code:
     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 :)

    Comment

    • cephal0n
      New Member
      • Jan 2008
      • 38

      #3
      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.

      Comment

      • Jim Doherty
        Recognized Expert Contributor
        • Aug 2007
        • 897

        #4
        Originally posted by cephal0n
        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 :)

        Comment

        Working...