deepak.krishnan
In the zone
Hello friends,
I got a problem while executing the following code:
This code is in a module:
Public con As New ADODB.Connection
Public rs1 As ADODB.Recordset
Public rs2 As ADODB.Recordset
The following code is in the form:
Private Sub Form_Load()
con.Open "Provider=MSDAORA;user id=scott;password=tiger;"
rs1.Open "notes", con, adOpenDynamic, adLockOptimistic
Set txtnb.DataSource = rs1
txtnb.DataField = "NOTES"
End Sub
Private Sub Form_Unload(Cancel As Integer)
frmintro.Show
End Sub
Private Sub imgback_Click()
If rs1.BOF = True Then
rs1.MoveLast
MsgBox "This is the first record. Now the last record saved will be opened"
Else
rs1.MovePrevious
End If
End Sub
Private Sub imgdel_Click()
rs1.Delete
End Sub
Private Sub imgfw_Click()
If rs1.EOF = True Then
rs1.MoveFirst
MsgBox "This is the last record. Now the first record saved will be opened"
Else
rs1.MoveNext
End If
End Sub
Private Sub imgnew_Click()
rs1.AddNew
End Sub
Private Sub imgprint_Click()
cdmain.ShowPrinter
End Sub
Private Sub imgsave_Click()
rs1.Update
rs1.MoveNext
End Sub
Now when I execute this code I get an error saying that the field cannot be updated due to datatype or lock type .
Can any one of you please tell me what is the problm with the code?
I got a problem while executing the following code:
This code is in a module:
Public con As New ADODB.Connection
Public rs1 As ADODB.Recordset
Public rs2 As ADODB.Recordset
The following code is in the form:
Private Sub Form_Load()
con.Open "Provider=MSDAORA;user id=scott;password=tiger;"
rs1.Open "notes", con, adOpenDynamic, adLockOptimistic
Set txtnb.DataSource = rs1
txtnb.DataField = "NOTES"
End Sub
Private Sub Form_Unload(Cancel As Integer)
frmintro.Show
End Sub
Private Sub imgback_Click()
If rs1.BOF = True Then
rs1.MoveLast
MsgBox "This is the first record. Now the last record saved will be opened"
Else
rs1.MovePrevious
End If
End Sub
Private Sub imgdel_Click()
rs1.Delete
End Sub
Private Sub imgfw_Click()
If rs1.EOF = True Then
rs1.MoveFirst
MsgBox "This is the last record. Now the first record saved will be opened"
Else
rs1.MoveNext
End If
End Sub
Private Sub imgnew_Click()
rs1.AddNew
End Sub
Private Sub imgprint_Click()
cdmain.ShowPrinter
End Sub
Private Sub imgsave_Click()
rs1.Update
rs1.MoveNext
End Sub
Now when I execute this code I get an error saying that the field cannot be updated due to datatype or lock type .
Can any one of you please tell me what is the problm with the code?
Last edited: