|
-
Mar 1st, 2004, 03:54 AM
#1
Thread Starter
Frenzied Member
Problem With combo-box ***(KIND A) RESOLVED ***
Whenever I fill a combo-box from a recordset (with this code):
VB Code:
While Not TempRS.EOF
Combo1.AddItem TempRS.Fields("sdOmsch"), TempRS.Fields("ndCode")
TempRS.MoveNext
Wend
ndCode = integer
sdOmsch = string
This is no problem, but whenever I (the code) try's to add the 27th item, it gives an error:
Run-time error '5':
Invalid procedure call or argument
Does anybody have a clue
Ow, yes ndCode is the primary key of that table
Last edited by Lightning; Mar 1st, 2004 at 05:26 AM.
-
Mar 1st, 2004, 04:23 AM
#2
Are you sure there is some data in the database?
If its empty it will cause an error.
VB Code:
While Not TempRS.EOF
If Not IsNull(CStr(TempRS.Fields)) Then
Combo1.AddItem TempRS.Fields("sdOmsch"), TempRS.Fields("ndCode")
End If
TempRS.MoveNext
Wend
Not sure if I've pasted this correctly, I can't see your code but it checks to see if there is a valid entry.
-
Mar 1st, 2004, 04:24 AM
#3
Thread Starter
Frenzied Member
Well yes there is a check. (and I know for shure there is some data in), it adds data, only where the index is more as 26 it raeses the error
-
Mar 1st, 2004, 04:42 AM
#4
sdOmsch or ndCode are not Null?
-
Mar 1st, 2004, 04:46 AM
#5
Thread Starter
Frenzied Member
Both are not NULL, the strange thing is that whenever I don't use the INDEX all works fine. But why can't I set the index to a higher value than 26???
-
Mar 1st, 2004, 04:48 AM
#6
What's the data type of nCode in the database?
-
Mar 1st, 2004, 04:52 AM
#7
-
Mar 1st, 2004, 04:53 AM
#8
Originally posted by hassa046
Is it possible that the index value you uccurs twice?
Not if the primary key is already set at the database (No duplicates)
Have to rush cant wait for your reply, but its probably because the index for the combobox is limited. Either use another contol (data combo, data list) or convert nCode to Integer, whichever works.
Last edited by leinad31; Mar 1st, 2004 at 07:01 AM.
-
Mar 1st, 2004, 05:26 AM
#9
Thread Starter
Frenzied Member
I kind a solved it. I don't use the index, but it still is strang
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
|