CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    Join Date
    Dec 2008
    Location
    Step Into(F11)
    Posts
    465

    Talking Re: Run Time Error 3201

    Try now .
    Code:
    Private Sub lap()
     Dim cnuser As New ADODB.connection
      Dim rsupdate As New ADODB.Recordset
      Dim reply As String
      
        'Call connection(cnuser, App.Path & "\Medrar.mdb", "endromida")
        Call connection(cnuser, "\\mika\medrar\Medrar.mdb", "endromida")
        Call Recordset(rsupdate, cnuser, "SELECT condi,lannum FROM reser where lannum = ' & txtSaLan.Text & '")
        
           
             With rsupdate
             if not (rs.eof and rs.bof) then
                rsupdate.addnew
               .Fields!condi = txtText2.Text
               .Update
             End If
             End With
             
        
    Set cnuser = Nothing
    Set rsupdate = Nothing
    End Sub

  2. #17
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Run Time Error 3201

    Of course it does not work you really need to pay more attention to what you are doing and what you have been shown.
    Code:
    If .BOF = False And .EOF = True Then
    You have told it to only update if EOF is true which means that it can never work. go back and read the previous posts. Read the error message that comes up. It should be clear what is wrong.
    Always use [code][/code] tags when posting code.

  3. #18
    Join Date
    Sep 2010
    Posts
    42

    Re: Run Time Error 3201

    Code:
    With rsupdate
             If .BOF = True And .EOF = True Then
             .Fields!condi = txtText2.Text
             .Update
             End If
             End With
    
    or
    With rsupdate
             If .BOF = False And .EOF = False Then
             .Fields!condi = txtText2.Text
             .Update
             End If
             End With
    or
    With rsupdate
             if not (rs.eof and rs.bof) then
                rsupdate.addnew
               .Fields!condi = txtText2.Text
               .Update
             End If
             End With
    ***********
    Same problem, exist

  4. #19
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Run Time Error 3201

    Not true. This piece of code will not give the error you mentioned
    Code:
    With rsupdate
             If .BOF = False And .EOF = False Then
             .Fields!condi = txtText2.Text
             .Update
             End If
             End With
    In othe rpeices you had posted you were testing to see if it were true then you get a message telling you either EOF or BOF is true which would always be the case since you explicitly told it to olny do the update when this was the case.

    The code above does not attempt an update unless both values are false so it will not generate an error telling you it is true.

    You did however have more than one spot in yoru code where you had the same issue so maybe it is not in the place where you changed it or maybe you are getting a different error now.
    Always use [code][/code] tags when posting code.

Page 2 of 2 FirstFirst 12

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured