Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Operation Not Allowed in this Context Error

Status
Not open for further replies.

ShaneBrennan

Programmer
May 19, 1999
198
GB
Hello

I have an access database and a VB6 application that will interigate the access database and produce a report in word using automation.

This works perfectly except for memo fields. Where I get about 260 characters perfectly then I get the silly Hieroglyphics symbols appearing.

Someone suggested using adodb and the getchunk function. However I get an "Operation Not Allowed in this Context" Error when using the get chunk method on the following code:



Set Conn = CreateObject("ADODB.Connection")
Conn.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & DB & ";"
Conn.Open


Set rsSurvey = Conn.Execute("SELECT TheMemo from tblSurveyData where Surveys.ID = " & 601)

MemChunk = rsSurvey("TheMemo").GetChunk(4000)

Can anyone help me please.

Thank you in advance for any help given.

Shane Brennan
 
Thank you Frederico, I will give it a try.

In the mean time - I found out what is causing my original problem - but unsure of the reason.

The code I gave was not the real code, but a simplified version of the select statement (the rest is the same).

My original one took information from a query instead of from the table.

If I used "select Recommendations as TheMemoField...." it works fine however if I use an IF statement if check to see if the memo is empty then use N/A instead:

"Select iif([recommendations]>"",[Recommendations],"N/A" as TheMemoField........" then I get a string returned but the 1st 260 characters are ok - the rest are Hieroglyphics.

The solution is simply to remove the if statement and live with not having N/As for now.

But again thank you for talking the time to respond to my request for help, and I will look at your solution.





Shane Brennan


 
ah. that is your problem on this case then.

GetChunk can only be used on MEMO fields (access case). If used on other type of fields it will not work.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top