|
-
Nov 18th, 1999, 05:05 AM
#1
Thread Starter
Member
I have declared the following in a bas module.
Public cnMainData As Connection
Public rs As Recordset
Then in the form load event I wrote
Set cnMainData = New Connection
Set rs = New Recordset
With cnMainData
.Provider = "Microsoft.Jet.OLEDB.3.51"
.ConnectionString = "c:\Anita\db1.mdb"
.Open
End With
With rs
.Open "Employer", cnMainData, adOpenDynamic
.AddNew
!CompanyName = Text1.Text
!Vocation = Text2.Text
!ContactPerson = Text3.Text
!Address = Text4.Text
!city = Text5.Text
!ZipCode = Text6.Text
!Phoneno = Text7.Text
!FaxNo = Text8.Text
!EmailId = Text9.Text
!PreviousPlacements = Text10.Text
.Update
End With
It is giving a run-time error 3251
for rs.addnew.
" The operation required by the application is not supported by the provider.
If I declare
Public cnMainData As ADODB.Connection
Public rs As ADODB.Recordset
it is giving the same result.
-
Nov 18th, 1999, 11:45 AM
#2
Hyperactive Member
You have opened the recordset in the default locking mode i.e. read only mode. Therefore you are unable to add records to it.
Instead of this
.Open "Employer", cnMainData, adOpenDynamic
try this
.Open "Employer", cnMainData, adOpenDynamic,adlockoptimistic
It will work
-
Nov 18th, 1999, 08:08 PM
#3
Thread Starter
Member
Thank you so much.It is working!!!!!!!Yesterday I spent so many hours trying to solve the problem.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|