run-time error (80040e21) Multiple-step OLE DB
Hi all
I have the following error
run-time error (80040e21) Multiple-step OLE DB
when I execute the code
Public Function InserePresenca(ByVal Uid As Long, ByVal autorizacao As String, _
myConn As ADODB.Connection) As Integer
Dim myRs As ADODB.Recordset
Dim tmpDate As Date
Set myRs = New Recordset
With myRs
.CursorType = adOpenForwardOnly
.LockType = adLockOptimistic
.Open "Presenças", myConn, , , adCmdTable
End With
myRs.AddNew
Please Help!!!
Re: run-time error (80040e21) Multiple-step OLE DB
Please Post in which line you are getting the error, For getting the connection in the vb through a simple code read the tutorial at my signature click on the Vb New user general Problem. :wave:
Re: run-time error (80040e21) Multiple-step OLE DB
I'm not sure about this, but the problem might be to do with the table name. Try this instead of your With block:
VB Code:
myRs.Open "SELECT * FROM [Presenças]", myConn, adOpenForwardOnly, adLockOptimistic, adCmdText
..if that doesn't work, try changing adLockOptimistic to adLockReadOnly.
Re: run-time error (80040e21) Multiple-step OLE DB
Hi
Thank you
I solved the problem..
In one line of the code
myRs("Tipo") = autorizacao
The error was caused because Myrs("Tipo") was type nvchar(1) and autorizacao was = "MEG"
Thank you