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

ADO Recordset.AddNew Error

Status
Not open for further replies.

Elena

Technical User
Oct 20, 2000
112
US
Hi Guys,

I am trying to add a new record to a table in an Access Database, which I have been able to access with no problems. When I try to add a new record, I get the following error:

"Runtime error '3251': Object or provider is not capable of performing requested operation."

Here is how I am opening the recordset.

g_strSQL = "SELECT * from Models"
Set rstModels = New Recordset
rstModels.Open g_strSQL, CN, adOpenDynamic


And here is how I am trying to add a new record.

rstModels.AddNew
rstModels!ModelNumber = g_strModel
rstModels!Profile = g_strProfile
rstModels!DeviceTypeID = g_intDriveType
rstModels.Update

Can someone tell me what I am doing wrong? I am trying to learn and write a program at the same time. Sorry if this seems remedial.

Thanks,
Elena
 
Hi Guys,

I really need to try harder before I post these questions. I keep figuring it out on my own.

In this case I figured that I had to specify the LockType as adLockOptimistic in order for it to work. Honestly, I don't fully understand the whole LockType thing, which is why I didn't specify it in the first place. Maybe someone can explain it to me.

Thanks,
Elena
 
Take a look at faq222-3670. It might help explain things a bit.

Take Care,

zemp

"Show me someone with both feet on the ground and I will show you someone who can't put their pants on."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top