Opening one table and writing to another

ThatDougGuy

Registered User.
Local time
Today, 23:13
Joined
Feb 25, 2001
Messages
10
I need to open one table read the records in a loop, but in the middle if the loop i will need to write the data to another table after i work with it. I'm not sure what to do.


'Open txtTable For Input As 1
DoCmd.OpenTable txtTable, , acReadOnly

Recordset.MoveFirst

Do Until EOF(1)

Select Case cboNewFormat
case statments
call Save
End Select
Recordset.MoveNext
Loop

End Sub

Private Sub Save()
Open NewDateTable For Output As 2
Recordset.AddNew

End Sub
 
first dimension your recordsets as different names in the same procedure.

dim db as database
dim rst1, rst2 as recordset

set rst1=db.openrecordset("txttable")
set rst2=db.openrecordset("newdatetable")

rst1.MoveFirst

Do Until rst1.eof

Select Case cboNewFormat
case statments
save:
with rst2
.addnew
for i=0 to .fields.count-1
.field(i)=rst1.field(i)
next i
.update
endwith
End Select
Recordset.MoveNext
Loop

End Sub
 
Thanks That helped alot

when i use the
Dim db as Database
It will not take it ( "not user Difined" )

and on the set rst1 = bd.openrecordset("txtTable")

i wanted to bring that in from a form can i do that ?
 

Users who are viewing this thread

Back
Top Bottom