|
-
May 30th, 2006, 01:05 AM
#1
Thread Starter
Lively Member
[RESOLVED]Data control Runtime Error 3426
Hello All
I am trying to setup a small database program for personal use, as i have done many times before. But for some reason i am having trouble getting this one to work.
I simply have a Data control filling in data bound text or combo boxes with the current selections data. But when i try to move to another selected record by using the
VB Code:
Dim Item As String
Item = dbcItemNumber.Text
Data1.Recordset.FindFirst "ItemNumber = '" & Item & "'
i get an error...
Runtime Error '3426'
This action was canceled by an associated object.
This is frustraing as this is the same code i've used for other programs and they worked and are still working. Also if i get rid of the variable Item and just have
VB Code:
Data1.Recordset.FindFirst "ItemNumber = 'X001'
It works.
Any ideas anyone?
Last edited by Hojo; May 30th, 2006 at 01:59 AM.
Despite body and mind, my youth will never die!
Everytime I learn something new it pushes some old stuff out of my brain!
-
May 30th, 2006, 01:07 AM
#2
Re: Data control Runtime Error 3426
what happens if you rename Item to sItem?
& what does the textbox have in it?
-
May 30th, 2006, 01:09 AM
#3
Thread Starter
Lively Member
Re: Data control Runtime Error 3426
Exactly the same thing.
I've also had no variable and had
VB Code:
Data1.Recordset.FindFirst "ItemNumber = '" & dbcItemNumber.Text & "'
No matter what i get the same error msg.
Despite body and mind, my youth will never die!
Everytime I learn something new it pushes some old stuff out of my brain!
-
May 30th, 2006, 01:10 AM
#4
Re: Data control Runtime Error 3426
Shouldn't it be:
VB Code:
"ItemNumber = '" & dbcItemNumber.Text & "'[B]"[/B]
-
May 30th, 2006, 01:11 AM
#5
Thread Starter
Lively Member
Re: Data control Runtime Error 3426
The Input box is a data bound combo box (allthough i have also tried just straight text box) and it is populated with the records of the record set. Its meant to be used to select what record you want to move to.
Despite body and mind, my youth will never die!
Everytime I learn something new it pushes some old stuff out of my brain!
-
May 30th, 2006, 01:12 AM
#6
Thread Starter
Lively Member
Re: Data control Runtime Error 3426
Yes it should have an extra " that was just a typo for the forum. My program had the extra "
Sorry My bad.
Despite body and mind, my youth will never die!
Everytime I learn something new it pushes some old stuff out of my brain!
-
May 30th, 2006, 01:12 AM
#7
Re: Data control Runtime Error 3426
i put a quote mark at the end of the string. although it shouldn't even compile with that missing - was it just a typo?
-
May 30th, 2006, 01:17 AM
#8
Re: Data control Runtime Error 3426
Try putting it in separate lines
sTemp = "ItemNumber = '" & Item & "' "
Data1.Recordset.FindFirst sTemp
-
May 30th, 2006, 01:19 AM
#9
Re: Data control Runtime Error 3426
or:
VB Code:
Data1.Recordset.FindFirst CStr("ItemNumber = '" & Item & "'")
Also double check the values being passed to it for rogue spaces and alike
-
May 30th, 2006, 01:21 AM
#10
Thread Starter
Lively Member
Re: Data control Runtime Error 3426
2 Good theories but still no luck on both accounts.
As i said it's frustrating because i've done this so many times before with no troubles.
there has to be somthing obscure that i'm missing.
Despite body and mind, my youth will never die!
Everytime I learn something new it pushes some old stuff out of my brain!
-
May 30th, 2006, 01:30 AM
#11
Re: Data control Runtime Error 3426
Does it work if you do this:
VB Code:
Dim sItem As String ' Item is a reserved word so I've changed it
sItem = "X001"
Data1.Recordset.FindFirst "ItemNumber = '" & sItem & "'"
If it does, then the problem is with the data being passed to the variable from the textbox
-
May 30th, 2006, 01:36 AM
#12
Thread Starter
Lively Member
Re: Data control Runtime Error 3426
It sort of works.
During my error searching i have put the the code i first gave you into the click event of a button instead of the change event of the combobox.
So now with your new code if i start the program up and just press the button it changes the record to X001 but if i change the combobox first then i get the error msg.
Perhaps there is somthing with the data bound combo box but i've tried it just with a text box and got the same result (although the textbox was also data bound.)
Despite body and mind, my youth will never die!
Everytime I learn something new it pushes some old stuff out of my brain!
-
May 30th, 2006, 01:40 AM
#13
Re: Data control Runtime Error 3426
I don't know enough about them to be of much more use i'm afraid: Bound Controls = Evil
Just use ADO instead
-
May 30th, 2006, 01:43 AM
#14
Thread Starter
Lively Member
Re: Data control Runtime Error 3426
Ok another development for us all to ponder over.
I put in an extra textbox not linked to the database and used this to type in the item numbers manually and use this value to update the record set and it worked but again if i changed the combobox then it all goes pear shaped again.
Perhaps you are right Dat abound controls = evil,
But when they work they make life so much easier.
Thank you for all you trying though.
cheers mate.
Despite body and mind, my youth will never die!
Everytime I learn something new it pushes some old stuff out of my brain!
-
May 30th, 2006, 01:58 AM
#15
Thread Starter
Lively Member
Re: Data control Runtime Error 3426
Ok I have found a solution.
If at first you don't suceed CHEAT!
I have removed the fieldbinding of the combobox. but left its list field binding so that i still get the comboboxes list updated by the recordset with all entered items. Then i just change the combobox's .text property on form load to equal the recordsets first item and it looks like it is exactly the same as before (except it works)
I hope all that rambling makes sense. Let me know if anyone needs me to breath then explain it more clearly.
thanks again all who helped out.
Cheers.
Despite body and mind, my youth will never die!
Everytime I learn something new it pushes some old stuff out of my brain!
-
May 30th, 2006, 02:00 AM
#16
Re: [RESOLVED]Data control Runtime Error 3426
I'll say it again: Bound Controls = Evil 
Glad you found a solution
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
|