Use the Command Button Wizard. Just drag a new button to your form, the
Command Button Wizard starts. The second option in the list is Record
Operatoions. The first item in the next list is Add New Record. click Next,
choose a lable or picture for your button, click next choose a name
(cmdAddNew) for example, and click Finish: The following code results:
Private Sub cmdAddNew_Click()
On Error GoTo Err_cmdAddNew_Click
DoCmd.GoToRecord , , acNewRec
Exit_cmdAddNew_Click:
Exit Sub
Err_cmdAddNew_Click:
MsgBox Err.Description
Resume Exit_cmdAddNew_Click
End Sub
--
Everything in EXCESS!!! If you want to taste the flavor of LIFE, Take BIG
Bytes. Moderation is for monks…
"share database with more than one users" wrote:
> Hello,
>
> I didn't use acess forms for a while and I totally forgot how
> to add records using the command button in a form. I would like to get that
> code.
> Any help really appreciated.
>
|