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 :eek:
Thanks.
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 :eek:
Thanks.
Its amazing how much of a pain this can be and its only one line of code...
Put that in the buttons click event handler and your done :)
Cheers,
RyanJ
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
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
Re: Invoking a form from a command button
oh i figured it out - i didnt put the form name in :blush:
thanks for ur help :thumb:
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 :blush:
thanks for ur help :thumb:
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