-
Mar 18th, 2014, 11:26 PM
#1
[RESOLVED] Run-time error '3001'
Hi,
I am receiving Run-time error '3001' Arguments of the wrong type, are out of acceptable range or are in conflict with eachother.
Code:
If Not Text1.Text = rs.Fields("PlayerID") Then
rs.AddNew 'adding new record
Else
rs.Find rs.Fields("PlayerID") = Text1.Text
End If
Text1.Text = rs.Fields("PlayerID")
rs.Fields("Score") = ScoreHolder
rs.Update 'Handle the data
the error is on this line
Code:
rs.Find rs.Fields("PlayerID") = Text1.Text
Not sure why I am receiving that error? Another project of mine using that code has no problems.
Code:
If Not Form1.txtContactID.Text = rs.Fields("CustomerID") Then
rs.AddNew 'adding new record
Else
rs.Find Form1.txtContactID.Text = rs.Fields("CustomerID")
End If
Thanks,
Nightwalker
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Mar 19th, 2014, 12:11 AM
#2
Re: Run-time error '3001'
Should it not be like this?
Code:
rs.Find "PlayerID = '" & Text1.Text & "'"
-
Mar 19th, 2014, 12:14 AM
#3
Re: Run-time error '3001'
Or if it is numeric then
Code:
rs.Find "PlayerID = " & Text1.Text
-
Mar 19th, 2014, 04:23 AM
#4
Re: Run-time error '3001'
In debug mode putting the cursor over both
Code:
Text1.Text = rs.Fields("PlayerID")
Text1.Text and rs.Fields("PlayerID") both have the value of "x" which is the player token for tic tac toe. However, I cannot figure out why
would be skipped over because the values look identical?
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Mar 21st, 2014, 02:44 AM
#5
Re: Run-time error '3001'
I rewrote the score sub as so and it works.
Code:
Private Sub score()
If rs.RecordCount < -1 Then
MsgBox "Please setup the database first!"
Else
rs.Find "PlayerID = '" & Retval & "'"
rs.Fields("PlayerID") = Retval
rs.Fields("Score") = ScoreHolder
rs.Update 'Handle the data
End If
End Sub
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Mar 21st, 2014, 08:53 AM
#6
Re: [RESOLVED] Run-time error '3001'
Code:
If rs.RecordCount < -1 Then
??
How could you have a recordcount <-1 ? Recordcount will be either 0 or >0 or possibly -1 if an error occurs
-
Mar 21st, 2014, 07:06 PM
#7
Re: [RESOLVED] Run-time error '3001'
Originally Posted by DataMiser
Code:
If rs.RecordCount < -1 Then
??
How could you have a recordcount <-1 ? Recordcount will be either 0 or >0 or possibly -1 if an error occurs
That should have been either 0 or = -1.
Edit:
However, when I ran the code it displayed the message only when it could not find the data.
Last edited by Nightwalker83; Mar 21st, 2014 at 07:08 PM.
Reason: Adding more!
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Mar 21st, 2014, 08:44 PM
#8
Re: [RESOLVED] Run-time error '3001'
hmm that does not make sense either since the find would not have been executed yet
-
Mar 21st, 2014, 09:15 PM
#9
Re: [RESOLVED] Run-time error '3001'
Originally Posted by DataMiser
hmm that does not make sense either since the find would not have been executed yet
Actually, I am correct in my original assumption because I am checking whether or not the default score "0" has been entered in in the database to start the game. "0" would be at position "-1" so anything less than that would mean the table is empty.
Code:
If rs.RecordCount < -1 Then MsgBox "Please setup the database first!"
and I have now placed that conditional statement after connecting to the database instead of at the start of saving the score to the database.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Mar 21st, 2014, 11:30 PM
#10
Re: [RESOLVED] Run-time error '3001'
There is no position -1
Recordcount returns the number of records in the recordset if there is 1 record it returns 1 if there are no records it returns 0. The only time I have ever saw a value of -1 is in cases where the cursor does not support the .recordcount property in which case it returns -1 even if there are 1 million records returned.
-
Mar 22nd, 2014, 02:36 AM
#11
Re: [RESOLVED] Run-time error '3001'
How you solve the problem? I have tried checking both either BOF or EOF and whether or not the values for the "PlayerID" and "Score" were empty but I keep receiving run time error '3021'.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Mar 22nd, 2014, 09:25 AM
#12
Re: [RESOLVED] Run-time error '3001'
Originally Posted by Nightwalker83
How you solve the problem? I have tried checking both either BOF or EOF and whether or not the values for the "PlayerID" and "Score" were empty but I keep receiving run time error '3021'.
If you want a reliable working Rs.Recordcount, you will simply have to ensure
Cnn.Cursorloaction = adUseClient
on the Connection you use, to open your Rs from.
That's what DataMiser hinted at with "-1 is returned only when the Cursor(Type) does not support ..." ...
The Rs cannot hand out a concrete Rs.Recordcount (yet). With a CursorType of adUseServer, the returned
Rs "knows" only that:
"there are records, but how many I cannot tell you yet, I'll give you a -1 to signalize that".
Olaf
Last edited by Schmidt; Mar 23rd, 2014 at 12:51 AM.
-
Mar 22nd, 2014, 11:53 PM
#13
Re: [RESOLVED] Run-time error '3001'
rs.Find "PlayerID like '" & Retval & "'"for some reason the find is having issues with the equals sign. I will try "like" and see if that solves the issue.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
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
|