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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error in Append General Class with vfp Sp9

Status
Not open for further replies.

avsalf

Programmer
Oct 19, 2009
18
CO
I run this code without Error in vfp9 Sp1, i update to SP2 and this error
appears 1436 Only insertable objects are allowed in General fields.

#Define CRLF Chr(13)+Chr(10)
#Define Tab Chr(9)
Create Table (_tmp_data Free (descrip c(20),cost n(9,2))
use _tmp_data alias table_tmp
insert into table_tmp values "p1",1000
insert into table_tmp values "p2",2000
insert into table_tmp values "p3",3000

Create Table (_tmp_gra Free (GRA G(4,0))

Select table_tmp
MCGDATA = "Producs"
Scan
MCGDATA = MCGDATA +Tab+Substr(Descrip,1,15)
Endscan
MCGDATA = MCGDATA + CRLF
Scan
MCGDATA = MCGDATA +Tab+Str(COST/1000,12)
Endscan
MCGDATA = MCGDATA + CRLF

Select Graphics
Append Blank
Append General GRA Class "msgraph.Chart.8" Data MCGDATA
 
this is a code:

#Define CRLF Chr(13)+Chr(10)
#Define Tab Chr(9)
Create Table _tmp_data Free (descrip c(20),cost n(9,2))
use _tmp_data alias table_tmp
insert into table_tmp values ("p1",1000)
insert into table_tmp values ("p2",2000)
insert into table_tmp values ("p3",3000)

Create Table _tmp_gra Free (GRA G(4,0))

Select table_tmp
MCGDATA = "Producs"
Scan
MCGDATA = MCGDATA +Tab+Substr(Descrip,1,15)
Endscan
MCGDATA = MCGDATA + CRLF
Scan
MCGDATA = MCGDATA +Tab+Str(COST/1000,12)
Endscan
MCGDATA = MCGDATA + CRLF

Select _tmp_gra
Append Blank
Append General GRA Class "msgraph.Chart.8" Data MCGDATA
 
snp_0083_d5gjur.png
 
Runs without error for me.

Maybe don't use "msgraph.Chart[highlight #FCE94F].8[/highlight]" but only "msgraph.Chart"
Maybe update to the latest Hotfix KB968409, which you can find at Then Version(4) should be 09.00.0000.7423

Bye, Olaf.

Olaf Doschke Software Engineering
 
First, check if you can even just do [tt]o = CREATEOBJECT("msgraph.Chart.8")[/tt]. I guess an office upgrade means you have a higher version of that. You can only specify OLE Classes you have available on your PC. I don't see the hotfix fixing Gen fields, so the reason will certainly be the missing class. It's advisable to upgrade to the latest hotfix anyway.

Bye, Olaf.

Olaf Doschke Software Engineering
 
I know this isn't the point of your question, and generally people don't like to store binary files inside (effectively) memo fields in VFP because of the bloat factor.

I wouldn't embed anything these days, I would use filetostr() to get the underlying file into a binary field and then use strtofile() to get it out and use it.

The embedding usually works, but sometimes the target PC doesn't have the exactly right software to support the image getting - in the way you expect - and you end up with a failure or just garbage.

In most cases the file written out using strtofile() will be readable by something on most machines, even if it's not the perfect package, using a shellexecute function.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
I second you, griff,

in the sample code case the GEN field is just in cursor, and a good assumption is this will drive a report. That's a case where you can work with a GEN field and an olebound control in the report. The general field only exists temporary, the data isn't shared and does not persist over long periods, changes of the OLE Server used to handle the General field are likely not occurring, so for reports it's a viable way to have other things than text and images.

The other solution would need to draw this graph and create an image file from it. Likewise for RTF text, if you use a similar way to print RTF formatted text and what else you might have as nice OLE controls.

You have to admit it's very easy to create such a graph if you see you just specify some TAB delimited text in the DATA parameter.

So the major point is either the Office suite is not having msgraph.Chart.8 but either an older or newer version compatible enough to create the same graph or it t's a bug and only works in the Hotfix. I assume it's likely the Office version at that PC not having msgraph.Chart.8, because I know no fixes about Gen fields. The code so far only puts the graph into a Gen field and as Mike also reports, works when you have an Office with some msgraph.Chart version and use msgraph.Chart or when you have the specific Office with msgraph.Chart.8

@avsalf, one good reason to use version specif ole class names is when you know something only works in that version, but you can normally assume compatibility, so don't make use of version sepcific OLE class names and first try without the .version suffix.

Bye, Olaf.



Olaf Doschke Software Engineering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top