First at all: I'm not a vb programmer, so please be patient with me. I just started and I'm working in a small project in which I need to move certain information from an Access database to a SQL 6.5 database.
I could open both databases pretty well, but I'm getting an error that says:
Run-time error '3027'
Cant't update. Database or object is read-only.
The line where I'm getting this error is marked with a (*).
As I said, I'm new to vb and I know I'm doing something wrong here, but I can't figure out what it is.
I'l be VERY grateful for any help.
Here is the code:
Sub First()
Set dbSQL65 = OpenDatabase("Harris", dbDriverNoPrompt, False, "ODBC;DATABASE=TestHarris;UID=sa;PWD=;DSN=Harris"
Set rsSQL65 = dbSQL65.OpenRecordset("Test", dbOpenDynaset)
Set dbHarris = OpenDatabase("File.mdb", False, False)
Set rsHarris = dbHarris.OpenTable("Table1"
Call Export
End Sub
Private Sub Export()
rsHarris.MoveFirst
Do
rsSQL65.AddNew (*)
rsSQL65("FIELD1"
= rsHarris("NAME_1ST"
rsSQL65("FIELD2"
= rsHarris("NAME_LAST"
rsSQL65("FIELD3"
= rsHarris("COUNTY"
rsSQL65.Update
rsHarris.MoveNext
Loop Until rsHarris.EOF
End Sub
I could open both databases pretty well, but I'm getting an error that says:
Run-time error '3027'
Cant't update. Database or object is read-only.
The line where I'm getting this error is marked with a (*).
As I said, I'm new to vb and I know I'm doing something wrong here, but I can't figure out what it is.
I'l be VERY grateful for any help.
Here is the code:
Sub First()
Set dbSQL65 = OpenDatabase("Harris", dbDriverNoPrompt, False, "ODBC;DATABASE=TestHarris;UID=sa;PWD=;DSN=Harris"
Set rsSQL65 = dbSQL65.OpenRecordset("Test", dbOpenDynaset)
Set dbHarris = OpenDatabase("File.mdb", False, False)
Set rsHarris = dbHarris.OpenTable("Table1"
Call Export
End Sub
Private Sub Export()
rsHarris.MoveFirst
Do
rsSQL65.AddNew (*)
rsSQL65("FIELD1"
rsSQL65("FIELD2"
rsSQL65("FIELD3"
rsSQL65.Update
rsHarris.MoveNext
Loop Until rsHarris.EOF
End Sub