hai
please any body can give me code how to insert one row in already prepared table in ms access

Recommended Answers

All 4 Replies

hai
please any body can give me code how to insert one row in already prepared table in ms access

Hi regalla_c,

Try these SQL codes. Hope these codes will help you.

'declaration
Option Explicit
Dim DB As Database
Dim S As String

Private Sub Form_Load()
Set DB = OpenDatabase(App.Path + "\Gbusiness.mdb")
End Sub

Private Sub CmdAdd_Click()
'Adding new record
S = "Insert into TeamAddress (slno, Name, Address) values("
S = S + "'" + Text1.Text + "'" + ","
S = S + "'" + Text2.Text + "'" + ","
S = S + "'" + Text3.Text + "'" + ")"
DB.Execute (S)
End Sub

Hi,
I don't think P.manidas' code will Add New row to already created Table however it may add records to database.

Thankx

try this if using ADODB for database connection.

conn.begintrans            'ADODB connection object.
conn.execute "your insert statement goes here"
conn.committrans

Use ADODB.Connection
Use ADODB.Recordset

rc.AddNew 'Where rc ADODB RecordSet
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.