Make it with DAO

T

Thomas Sandgruber

Hello Michael!

You can add a new record to the database.

perhaps this is not the best way and perhaps there are some other answers
you will get, which perfor an easier way, but it doesn't matter.

I always to it like this

The "On Click" event of your command button should call a function or SUB



In this Sub you write the following code:

DIM DB as database

DIM rs as recordset

Set Db = CurrentDb

Set rs = Db.OpenRecordset("name of the table")

rs.AddNew



' perhaps you want to fill some datas into the fields of the new record here
the code for this

rs![AdressID] = name of a filed

rs![AnsprechID] = "123"

' write record to the table

rs.Update


' close table

rs.Close

Please make sure that you have under Extras - referenz the Microsoft DAO
Object Library 3.6 included. Standing at the 3 line.

By Thomas
 
Top