×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Error in Append General Class with vfp Sp9

Error in Append General Class with vfp Sp9

Error in Append General Class with vfp Sp9

(OP)
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

RE: Error in Append General Class with vfp Sp9

(OP)
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

RE: Error in Append General Class with vfp Sp9

(OP)

RE: Error in Append General Class with vfp Sp9

(OP)

RE: Error in Append General Class with vfp Sp9

First, check if you can even just do o = CREATEOBJECT("msgraph.Chart.8"). 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
https://www.doschke.name

RE: Error in Append General Class with vfp Sp9

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 Smileing

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.

RE: Error in Append General Class with vfp Sp9

I can't add much, except to say that your code works perfectly for me. (The code in your second post.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Error in Append General Class with vfp Sp9

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
https://www.doschke.name

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close