PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
[RESOLVED]Data control Runtime Error 3426-VBForums
Results 1 to 16 of 16

Thread: [RESOLVED]Data control Runtime Error 3426

  1. #1

    Thread Starter
    Lively Member Hojo's Avatar
    Join Date
    Jul 2005
    Location
    Brisbane, Australia
    Posts
    119

    Resolved [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:
    1. Dim Item As String
    2.    
    3.     Item = dbcItemNumber.Text
    4.     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:
    1. 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!

  2. #2
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Data control Runtime Error 3426

    what happens if you rename Item to sItem?

    & what does the textbox have in it?

  3. #3

    Thread Starter
    Lively Member Hojo's Avatar
    Join Date
    Jul 2005
    Location
    Brisbane, Australia
    Posts
    119

    Re: Data control Runtime Error 3426

    Exactly the same thing.

    I've also had no variable and had

    VB Code:
    1. 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!

  4. #4
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Data control Runtime Error 3426

    Shouldn't it be:
    VB Code:
    1. "ItemNumber = '" & dbcItemNumber.Text & "'[B]"[/B]

  5. #5

    Thread Starter
    Lively Member Hojo's Avatar
    Join Date
    Jul 2005
    Location
    Brisbane, Australia
    Posts
    119

    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!

  6. #6

    Thread Starter
    Lively Member Hojo's Avatar
    Join Date
    Jul 2005
    Location
    Brisbane, Australia
    Posts
    119

    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!

  7. #7
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    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?

  8. #8
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: Data control Runtime Error 3426

    Try putting it in separate lines

    sTemp = "ItemNumber = '" & Item & "' "
    Data1.Recordset.FindFirst sTemp

  9. #9
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Data control Runtime Error 3426

    or:
    VB Code:
    1. Data1.Recordset.FindFirst CStr("ItemNumber = '" & Item & "'")
    Also double check the values being passed to it for rogue spaces and alike

  10. #10

    Thread Starter
    Lively Member Hojo's Avatar
    Join Date
    Jul 2005
    Location
    Brisbane, Australia
    Posts
    119

    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!

  11. #11
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Data control Runtime Error 3426

    Does it work if you do this:
    VB Code:
    1. Dim sItem As String ' Item is a reserved word so I've changed it
    2.    
    3.     sItem = "X001"
    4.     Data1.Recordset.FindFirst "ItemNumber = '" & sItem & "'"
    If it does, then the problem is with the data being passed to the variable from the textbox

  12. #12

    Thread Starter
    Lively Member Hojo's Avatar
    Join Date
    Jul 2005
    Location
    Brisbane, Australia
    Posts
    119

    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!

  13. #13
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    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

  14. #14

    Thread Starter
    Lively Member Hojo's Avatar
    Join Date
    Jul 2005
    Location
    Brisbane, Australia
    Posts
    119

    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!

  15. #15

    Thread Starter
    Lively Member Hojo's Avatar
    Join Date
    Jul 2005
    Location
    Brisbane, Australia
    Posts
    119

    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!

  16. #16
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    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
  •  



Featured


Click Here to Expand Forum to Full Width