Macros - to Delete Records or Add New Records

P

Pele

I have created a data entry form and two of the
capabilities I want on the form are to have a command
button that allows the User to delete the present record
displyed on the form and another button to allow the User
to move to the end of the table linked to the form and add
new record.

I know I could do this by using built in menus attached to
the form, but I didn't want to use form menus. I want to
use command buttons linked to macros.

I also used a Wizard to create the Command buttons to the
the above task, but the event procedures the wizard used
was corrupting Access i.e. Access crashes anytime I enter
data into a particular field with a validation rule.

Anyway, what macro commands can I use to Delete records or
add new records. Any sugestion will be helpfull. Thanks.

Pele
 
P

Pele

As earlier stated, I'd used the command button wizard but
the event procedure it created was causing Access to
crash. I don't know whether this is due to the fact that I
have a macro that runs on any mouse move.

Anyway, I am hoping I can create a macro to do what the
wizard did.

Pele
 
S

Steve Schapel

Pele,

As you have discovered, the Command Button Wizard is an abomination.

To delete the current record with a macro, use the
RunCommand/DeleteRecord macro action.
To enter a new record, it is not clear what you mean. If you mean the
user to be taken to a new record so they can enter the data, then use
the GoToRecord/New macro action. To actually enter a new record with
some pre-defined data, you may need to make an Append Query which
returns the data you want entered into the new record, and then you can
use the RunQuery action in your macro to run the append.
 
P

Pele

Thanks...everything works

-----Original Message-----
Pele,

As you have discovered, the Command Button Wizard is an abomination.

To delete the current record with a macro, use the
RunCommand/DeleteRecord macro action.
To enter a new record, it is not clear what you mean. If you mean the
user to be taken to a new record so they can enter the data, then use
the GoToRecord/New macro action. To actually enter a new record with
some pre-defined data, you may need to make an Append Query which
returns the data you want entered into the new record, and then you can
use the RunQuery action in your macro to run the append.

--
Steve Schapel, Microsoft Access MVP


.
 

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