Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to add multiple records in a recordset (DAO) ???

Status
Not open for further replies.

AccDeveloper

Programmer
Jul 13, 2003
7
0
0
CA
Hi,

I have 9 List boxes (3 sets of 3 listboxes for ClientName, ClienId and Balance) on a Form and want to insert the values into a TempTable with the same fields (ClientName, ClientID, Balance)

I have following code to write 1 record into the table:

Private Sub UpdateData()

Dim db As DAO.Database
Dim tblRst As DAO.Recordset

Set db = CurrentDb
Set tblRst = db.OpenRecordset("TempTable")

With tblRst

.AddNew

.Fields("ClientName") = Val (Me.Text1 & "")
.Fields("ClientID") = Val (Me.Text2 & "")
.Fields("Balance") = Val (Me.Text3 & "")

.Update

End With
tblRst.Close

End Sub

HOW DO I ADD ALL MY 3 SET OF RECORDS (I.E. MY FORM SHOWS 3 CLIENTS AT A TIME) ???

ANY HELP IS VERY MUCH APPRECIATED !!
THANKS,
VIC
 
h tblRst

.AddNew

.Fields("ClientName") = Val (Me.Text1 & "")
.Fields("ClientID") = Val (Me.Text2 & "")
.Fields("Balance") = Val (Me.Text3 & "")

.Update
.AddNew

.Fields("ClientName") = Val (Me.Text7 & "")
.Fields("ClientID") = Val (Me.Text8 & "")
.Fields("Balance") = Val (Me.Text9 & "")

.Update
.AddNew

.Fields("ClientName") = Val (Me.Text4 & "")
.Fields("ClientID") = Val (Me.Text5 & "")
.Fields("Balance") = Val (Me.Text6 & "")

.Update

End With


rollie@bwsys.net
 
if someone gives helpful tips, Vic, remember to say so by clicking the post as helpful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top