?
Solved

Help Runtime Error '3219' - Operation Not Allowed!!!!

Posted on 2003-03-12
8
Medium Priority
?
415 Views
Last Modified: 2013-12-25
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    
0
Comment
Question by:RiGMiK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
8 Comments
 
LVL 3

Expert Comment

by:OblivionSY
ID: 8118718
try storing the value into a variable 1st, and then CStr(Variable)  

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 here)

Dim RST as recordset
set RST = DBH.OpenRecordset("TableName")

With RST
   .AddNew
   !Attrib1 = text1.text
   !Attrib2 = Text2.text
   'etc
   .Update
End With
0
 

Author Comment

by:RiGMiK
ID: 8122991
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
0
 

Author Comment

by:RiGMiK
ID: 8123003
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
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:RiGMiK
ID: 8123131
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
0
 

Author Comment

by:RiGMiK
ID: 8123463
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!!!!
0
 

Author Comment

by:RiGMiK
ID: 8123504
I think I fixed the problem myself... after a few days of trying.

If I do Adodc1.Recordset.Updatebatch(adAffectCurrent), instead of Adodc1.Recordset.Update the problem seems to go away.  Could someone explain this?  Thanks
0
 

Author Comment

by:RiGMiK
ID: 8377497
Imma delete this question since i answered it myself a while back... thanx n e way ppl.

-RiGMiK
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 8377628
PAQ'd and points refunded.

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month10 days, 7 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question