run-time error (80040e21) Multiple-step OLE DB-VBForums
Results 1 to 4 of 4

Thread: run-time error (80040e21) Multiple-step OLE DB

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2002
    Posts
    108

    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!!!

  2. #2
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Arrow 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.

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    37,184

    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:
    1. myRs.Open "SELECT * FROM [Presenças]", myConn, adOpenForwardOnly, adLockOptimistic, adCmdText

    ..if that doesn't work, try changing adLockOptimistic to adLockReadOnly.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Oct 2002
    Posts
    108

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.