Add new record through Form view

R

Ranjith Kurian

I have a table which is linked to a form, i would like to have a command
button which will add a new record to my table.
On the click of command button it should view the last empty row of my table
in a form.
 
J

John W. Vinson

I have a table which is linked to a form, i would like to have a command
button which will add a new record to my table.
On the click of command button it should view the last empty row of my table
in a form.

The Click event should show [Event Procedure], and the code could be

Private Sub buttonname_Click()
DoCmd.GoToRecord acDataForm, Me.Name, acNewRecord
End Sub


Or you could use a Macro using the Go To Record action.
 
R

Ranjith Kurian

Thanks for the below code.

I even need a command button to delete the record in a table.

John W. Vinson said:
I have a table which is linked to a form, i would like to have a command
button which will add a new record to my table.
On the click of command button it should view the last empty row of my table
in a form.

The Click event should show [Event Procedure], and the code could be

Private Sub buttonname_Click()
DoCmd.GoToRecord acDataForm, Me.Name, acNewRecord
End Sub


Or you could use a Macro using the Go To Record action.
 
J

John W. Vinson

Thanks for the below code.

I even need a command button to delete the record in a table.

The toolbox Command Button Wizard will offer this as a choice.
 
F

Frank

Thanks for the below code.

I even need a command button to delete the record in a table.



John W. Vinson said:
On Sat, 26 Dec 2009 11:11:01 -0800, Ranjith Kurian
The Click event should show [Event Procedure], and the code could be
Private Sub buttonname_Click()
DoCmd.GoToRecord acDataForm, Me.Name, acNewRecord
End Sub
Or you could use a Macro using the Go To Record action.
--
             John W. Vinson [MVP]
.- Hide quoted text -

- Show quoted text -

John,

When I used the code above, I got Run_time error ' 2105' : You can't
go to specified record. Any idea?

Thanks

Frank
 

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