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

ADO or DAO?

Status
Not open for further replies.

CTOROCK

Programmer
May 14, 2002
289
US

Hello,

This is the way I'm used to saving records:

Dim Rst As Recordset
Dim db As databasd

Set db = CurrentDb
Set Rst = db.OpenRecordset("Tbl_MasterTable", dbOpenDynaset)

Rst.AddNew
Rst.Fields("Name") = txtname.Value
Rst.Fields("Account") = txtaccount.Value
Rst.Update
Rst.Close

However, I need to reference to DAO 3.5 in the library. Then I tried doing this:

Dim cn As ADODB.Connection
Dim RsF As ADODB.Recordset
Dim strSQL As String

Set cn = CurrentProject.Connection
Set RsF = New ADODB.Recordset
strSQL = "SELECT * FROM Tbl_MeasureInput;"

RsF.CursorLocation = adUseClient
RsF.Open strSQL, cn
RsF.AddNew
RsF.Fields("Member Last Name") = TxtLastName.Value

RsF.Update

But I get a runtime 3251 "Current recrodset does not support updating. This may be a limitation of the provider or of the selected locktype"

I don't know what's wrong. However, the bigger question is if anyone has any advice or opinion if I should not use DAO code? It's what I'm used to, but is it too old?

Thanks in advance for your time

"The greatest risk, is not taking one."
 
try

Code:
Dim cn As ADODB.Connection
Dim strSQL As String

Set cn = CurrentProject.Connection
strSQL = "insert into Tbl_MeasureInput ([Member Last Name])values (" & TxtLastName.Value
 & ")"

cn.Execute strSQL, cn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top