|
-
Nov 3rd, 2002, 05:12 PM
#1
Thread Starter
PowerPoster
Duplicates error in a field that isn't indexed
I'm getting the duplicates error, in a field that isn't indexed, and I've even tried indexing and allowing duplicates in that field of the access table. Same error. When you're using bound controls, do you have to manually move the recordset?
-
Nov 3rd, 2002, 07:37 PM
#2
Frenzied Member
Check to ensure that the backend field is not set to unique values.
Mega.
"If at first you don't succeed, then skydiving is not for you"
-
Nov 3rd, 2002, 07:39 PM
#3
Thread Starter
PowerPoster
I think I've discovered the problem, but I can't solve it, If you would be so kind, check this thread:
http://vbforums.com/showthread.php?s=&threadid=210682
-
Nov 3rd, 2002, 07:42 PM
#4
Frenzied Member
The error 'Insufficient key column' means that the VB is expecting to see a Primary key in the table.
If you dont have one, then add one. It doesn't matter that it may be a auto increment and you may never use it but it still needs it.
Mega.
"If at first you don't succeed, then skydiving is not for you"
-
Nov 3rd, 2002, 07:46 PM
#5
Thread Starter
PowerPoster
No it has a primary key. I'm not getting that error anymore. I'm getting a "Would cause duplicates " error. What I'm tryin to do is double click on a Hier. flexgrid, and open that rs in a form, and be able to update it. It only works with the 1st rs. All others give the above error. I'm not able to change the rs that is being pointed to. Would you look over my code in the above link/thread?
-
Nov 3rd, 2002, 07:57 PM
#6
Frenzied Member
I am unfamilliar with the way you are querying your recordset as I use unbound controls with ADO. However, I think is't possibly your bookmark that's causing the problem. Try changing your code so that your recordset returns 1 value.
VB Code:
rscomOES.Open ("SELECT [ISBN] WHERE [ISBN] = " & strISBN
rscomOES.Update
Mega.
"If at first you don't succeed, then skydiving is not for you"
-
Nov 3rd, 2002, 08:08 PM
#7
Thread Starter
PowerPoster
I get "Object or variable not set". Do you have to open the rs with bound controls? Do I have to set the value of rscomOES? That's the name of a query command in the de. I know the connection is open, because the 1st rs will update, and if I add "MoveNext" to the event, I can update the next. But I need to get the cursor to whatever the user selects, which is why I set the srtISBN = txtISBN.text. I just don't know how to say it in SQL to get the DB to reference that rs.
-
Nov 3rd, 2002, 08:12 PM
#8
Frenzied Member
Could you do...
VB Code:
Dim I as integer
For I = 1 to rscomOES.RecordCount
If rscomOES.Fields ("ISBN") = strISBN then
rscomOES.Update
Else
rscomOES.Movenext
End if
Next
Mega.
"If at first you don't succeed, then skydiving is not for you"
-
Nov 3rd, 2002, 08:20 PM
#9
Thread Starter
PowerPoster
It gives the duplicate error again. I actually tried that earlier. Been trying to solve this since this morning. It gives the duplicate error because my form is filled with a different rs, but the DB's cursor is still on the 1st rs. Therefore to put the rs I have, into the 1st row in the DB would create a duplicate in the prim. key field. That's why it's rejecting it.
-
Nov 3rd, 2002, 08:24 PM
#10
Frenzied Member
I fail to see why .Movenext is not working. I have to go now as it is 01:20am now. I will ponder on this and If you are still having problems tomorrow, I will get back in touch when I'm at work. I will be in a better position there to recreate your problem.
Sorry I can't be of further assistance at the moment. Please post here if you get it solved in the meantime.
Mega.
"If at first you don't succeed, then skydiving is not for you"
-
Nov 3rd, 2002, 08:58 PM
#11
Thread Starter
PowerPoster
MoveNext is working. If I include that it moves to the next rs. But I need it to move to the one the user clicks in a flexgrid, which opens the form that is bound to the DB. The FG is also dragged and dropped.
-
Nov 4th, 2002, 06:07 PM
#12
Frenzied Member
"If at first you don't succeed, then skydiving is not for you"
-
Nov 4th, 2002, 06:24 PM
#13
Thread Starter
PowerPoster
Well yes and no. I'm not having THAT problem. But I'm only programming about 4 weeks, so problems are a constant. The previous problem was solved when I learned that the find method of a rs doesn't require a requery. Just the field and the comparative string. Now I'm having probs with a search and find next sub.
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
|