user form or form attached to command button

S

SueM

Hi,

I have a form which has a command button on it.

When the user clicks the command button I want a user form
(or form) to pop up which allows entries into a different
table from the one the data on the rest of the main form
goes to. (The two tables are related but need to store
seperate types of data)

I know how to create a userform using the insert menu in
excel in visual basic and to make it pop up, but in access
in visual basic I don't have the option to insert a
userform on my insert menu.

It looks from the help files like this option should be
there is there a way to set this up?

Or more simply can I attach a form I already have to the
command button and if so what would be the command line to
do this assuming the form name is form2. I have tried the
command below but it doesn't seem to work.

Private Sub Command147_Click()
Me![form2].Show
End Sub

Any advice appreciated.

Thanks

Sue
 
F

Fredg

In Access, the command button click event would be:
DoCmd.OpenForm "Form2"

See Access Help regarding
DoCmd
and
OpenForm method.
 
S

SueM

Hey thanks Fred.

Worked a treat, I didn't have to change a thing

Cheers,

Sue
-----Original Message-----
In Access, the command button click event would be:
DoCmd.OpenForm "Form2"

See Access Help regarding
DoCmd
and
OpenForm method.

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


SueM said:
Hi,

I have a form which has a command button on it.

When the user clicks the command button I want a user form
(or form) to pop up which allows entries into a different
table from the one the data on the rest of the main form
goes to. (The two tables are related but need to store
seperate types of data)

I know how to create a userform using the insert menu in
excel in visual basic and to make it pop up, but in access
in visual basic I don't have the option to insert a
userform on my insert menu.

It looks from the help files like this option should be
there is there a way to set this up?

Or more simply can I attach a form I already have to the
command button and if so what would be the command line to
do this assuming the form name is form2. I have tried the
command below but it doesn't seem to work.

Private Sub Command147_Click()
Me![form2].Show
End Sub

Any advice appreciated.

Thanks

Sue


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top