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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open and close recordset

Status
Not open for further replies.

Cballe

Programmer
Apr 14, 2002
16
0
0
ZA
Hi there guys,

I am still a newbie and would appreciate it very much if someone could help me with the open and close method of the recordset in the code below. I get error messages like the object is closed and all kinds of things, but I know that it has something to do with the open and close of the recordset.....please guys!

My code:

Private Sub Command1_Click()

Dim CurrDateTime As Date
Dim NewRec As ADODB.Recordset
CurrDateTime = Now()

Set NewRec = New ADODB.Recordset
With NewRec
Set .ActiveConnection = fMain.datPrimaryRS.Recordset.ActiveConnection
.AddNew
.Fields("Name") = fMain.txtFields(0).Text
.Fields("Surname") = fMain.txtFields(1).Text
.Fields("Test_Results") = fTest.Label1.Caption
.Fields("Date") = CurrDateTime
.Update
End With
Set NewRec = Nothing
End Sub
 

Cballe,

Read the FAQ titled: Visual Basic Access programming simplified. It will explain step by step how to use recordsets.

Hope this helps,

John Stephens
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top