RiGMiK
asked on
Help Runtime Error '3219' - Operation Not Allowed!!!!
Hello, I'm brand new to experts exchange... so I'm praying here that this site will help me out. I'm having a problem using ADO in VB. I can connect fine, navigate through records (Access 2000 Database), Add records, Edit records, Delete records, Update records... with no problems. That is until I pass a commondialog.filename to a textbox and try to update the database. The problem is quite unusual, every time I save a record in the database, I requery the database... and have no problems with any textboxes (linked to fields) on my form. As soon as I pass the commondialog.filename to ANY textbox on my form and update... the update is successful, but then I get the error when the program requeries the recordset. Again, I'm using an ADODC data control with no problems on my VB6 (service pack 5) form, and having no problem with the update then requery... but after passing the commondialog1.filename to any textbox then update/requery the error pops up. Please help, I've been racking my brain for about 3 hours and searched the web up and down for something along the lines of this problem.
BTW... It is passing the path C:\Books2.Gif to a textbox/textboxes that are linked to fields inside the database (MSAccess 2000, Jet4) with valid datatypes. I've tried memo and text with a length of 255 chars. And if I type the path in it can save and requery, but if it gets passed from the commondialog.filename (Exactly the same string), it crashes during requery.
Thanks,
RiGMiK
BTW... It is passing the path C:\Books2.Gif to a textbox/textboxes that are linked to fields inside the database (MSAccess 2000, Jet4) with valid datatypes. I've tried memo and text with a length of 255 chars. And if I type the path in it can save and requery, but if it gets passed from the commondialog.filename (Exactly the same string), it crashes during requery.
Thanks,
RiGMiK
ASKER
Ok, The first thing I've tried is passing it to a variable and converting it to string... still same problem. It is quite strange, because if i load a file (Commondialog1.showopen, select a filename) and it passes Commondialog1.Filename to the textbox... save, requery... error. But if I do the same exact thing, and edit another textbox after then save and requery it works fine! I can't have the end-user make sure they update another textbox's text before saving a picture path. The exact error is 'Runtime error 3219 Operation not allowed in this context' ???
Is there another way that I can have the end user open a file and return the path and file name, besides using commondialog? That might do the trick. I will try using another data connection that is not bound to anything now and see what happens. :(
-RiGMiK
Is there another way that I can have the end user open a file and return the path and file name, besides using commondialog? That might do the trick. I will try using another data connection that is not bound to anything now and see what happens. :(
-RiGMiK
ASKER
Nope, using a different data connection gives same result. This problem is holding me up bigtime from meeting my deadline, and I would up the points for this question... but I am new to experts-exchange and have no more points. :(
-RiGMiK
-RiGMiK
ASKER
OK, breakthrough.... BUT A BAD ONE! I found that if I pass anything to the textboxes through code... and update/requery I get the same error. It only works if the textboxes are typed into by the end user. I even tried Text1.Text="blah"
Text1.Text=CStr(Blah)
Text1.Text=" & "'" & blah & "'" & "
PLEASE HELP ME FIGURE OUT WHY THIS IS OCCURING...
-RiGMiK
Text1.Text=CStr(Blah)
Text1.Text=" & "'" & blah & "'" & "
PLEASE HELP ME FIGURE OUT WHY THIS IS OCCURING...
-RiGMiK
ASKER
Another breakthrough... another bad 1! I found that it is causing the error not in the requery, but the updating the recordset. If I pass text through clicking a textbox and typing it works fine, but if i pass text through code: Text1.text="anything" .. and save that's when the error occurs, but if i resume next after the error is trapped, and save again it works fine. Please help!!!!
ASKER
I think I fixed the problem myself... after a few days of trying.
If I do Adodc1.Recordset.Updatebat ch(adAffec tCurrent), instead of Adodc1.Recordset.Update the problem seems to go away. Could someone explain this? Thanks
If I do Adodc1.Recordset.Updatebat
ASKER
Imma delete this question since i answered it myself a while back... thanx n e way ppl.
-RiGMiK
-RiGMiK
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What is the error you are getting?
if all else fails try having it NOT linked and use the following code
Dim DBH as DataBase
Set DBH = DBEngine.OpenDatabase(Path
Dim RST as recordset
set RST = DBH.OpenRecordset("TableNa
With RST
.AddNew
!Attrib1 = text1.text
!Attrib2 = Text2.text
'etc
.Update
End With