CmdButton to open form in edit mode

S

Sondra

I have a form that I have created that the data source is
a query from the master table. I want to add a button on
the form that opens the form in edit mode and running the
query. Can someone help me write the OnClick
[eventprocedure] for this?

Thanks in advance.
 
M

Marshall Barton

Sondra said:
I have a form that I have created that the data source is
a query from the master table. I want to add a button on
the form that opens the form in edit mode and running the
query. Can someone help me write the OnClick
[eventprocedure] for this?


Use the command button wizard to write the code for you.
You don't have to worry about edit mode as that's the
default.
 
G

Guest

Use the command button wizard to write the code for you.
You don't have to worry about edit mode as that's the
default.
I've done that; however it opens up the query and not the
form. I want to reopen the form and have the query ask
for the specific criteria. I was going to writ a macro
to close the form and reopen it in edit mode; but I want
to avoid macros if at all possible.

Thanks.
 
M

Marshall Barton

I've done that; however it opens up the query and not the
form. I want to reopen the form and have the query ask
for the specific criteria. I was going to writ a macro
to close the form and reopen it in edit mode; but I want
to avoid macros if at all possible.


No macros is good ;-)

Are you trying to open the same form that has the button??

If so, since OpenForm can only deal with a single instance
of a database object, you're going to have to bend over
backwards to make that happen. Let's try having the command
button just set the form's AllowEdits property to True.
Me.AllowEdits = True
 

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