-
June 4th, 2012, 04:31 AM
#16
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
-
June 4th, 2012, 07:55 AM
#17
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.
-
June 4th, 2012, 12:28 PM
#18
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
-
June 4th, 2012, 12:42 PM
#19
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|