Results 1 to 6 of 6

Thread: Invoking a form from a command button [Resolved]

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    49

    Resolved Invoking a form from a command button [Resolved]

    Hi,

    I'm trying to write code for a form that contains different command buttons. When a command button is pressed i want it to open another form which then gives the user to select options/checks from the form. I am not sure though how to do this?? I have looked at different VB books and all of them so far have only shown bringing up a message box prompt after a command button is pressed?? How can i bring up another form that lists options/check boxes/labels?????
    Am stuck

    Thanks.
    Last edited by chaos7; Jun 2nd, 2005 at 06:47 PM.

  2. #2
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Invoking a form from a command button

    Quote Originally Posted by chaos7
    Hi,

    I'm trying to write code for a form that contains different command buttons. When a command button is pressed i want it to open another form which then gives the user to select options/checks from the form. I am not sure though how to do this?? I have looked at different VB books and all of them so far have only shown bringing up a message box prompt after a command button is pressed?? How can i bring up another form that lists options/check boxes/labels?????
    Am stuck

    Thanks.

    Its amazing how much of a pain this can be and its only one line of code...

    VB Code:
    1. frmUserFormName.Show

    Put that in the buttons click event handler and your done

    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    49

    Re: Invoking a form from a command button

    hi ryan,

    i placed the code as below;

    Private Sub CommandButton1_Click()
    frmUserFormName.Show
    End Sub

    but it came up with a "Variable not defined" error when i pressed the button??? sorry..am still a starter in VB..

    thanks

  4. #4
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Invoking a form from a command button

    Quote Originally Posted by chaos7
    hi ryan,

    i placed the code as below;

    Private Sub CommandButton1_Click()
    frmUserFormName.Show
    End Sub

    but it came up with a "Variable not defined" error when i pressed the button??? sorry..am still a starter in VB..

    thanks
    In the code you need to replace frmUserFormName with the name of your UserForm

    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

  5. #5

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    49

    Re: Invoking a form from a command button

    oh i figured it out - i didnt put the form name in
    thanks for ur help

  6. #6
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Invoking a form from a command button

    Quote Originally Posted by chaos7
    oh i figured it out - i didnt put the form name in
    thanks for ur help

    You are wleocme

    If your question has been solved then please edit yout original post. Please change its icon to the green checkmark and add Resolved to the potsts title so everyone know this threads has been resolved

    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width