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
 

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