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

using addnew in ado

Status
Not open for further replies.

wala

Programmer
Aug 2, 2000
6
PH
I'm using VB 6 and Access 2000

An error occur when i'm adding a record. same thing with movelast and moveprevious.

Code:
    Set rsCmdty = New ADODB.Recordset
    rsCmdty.Open "select * from Data", "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source= c:\bocsystem\BOCLoc.mdb"
    rscmdty.AddNew
    With MSFlexGrid1
        rscmdty("CmdtyCd") = .TextMatrix(0, 1)
        rscmdty("Desc") = .TextMatrix(1, 1)
        rscmdty("CntryOrign") = Mid(1, .TextMatrix(2, 1), 2)
    End with
    rscmdty.update

the error message that appears...
the operation requested by the application is not supported by the provider.

should i add a reference to be able to access these commands. If yes, can you kindly tell me what it is?

Thanks in advance.
 
As standard ADO Recordsets return a Forward only cursor which does not allow Move commands.
Try using the following before opening the recordset:

Code:
rsCmdty.CursorType = adOpenDynamic

James :)
James Culshaw
jculshaw@active-data-solutions.co.uk
 
thanks for the immediate response. Moveprevious now works but not with addnew. Same error message occur even i use the code you had told me.

please help. thanks.
 
The locktype must set to adLockOptimistic, default is "adLockReadOnly"

so try this before rsCmdty.open :

rsCmdty.LockType = adLockOptimistic

heinz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top