Inserting an Object into a Field

  • Thread starter Thread starter Jay Moritz
  • Start date Start date
J

Jay Moritz

I have an Access 2000 database running on WinXP Pro.

I need to loop through a bunch of records creating a MSGraph Chart object
with data from a couple of fields in the active record. I only have one step
I can't seem to do, or find out how to do.

I can loop through all the records
I can create the MSGraph Chart object, format it and insert the required
data.
I can edit the record, I know I have to use the AppendChunk method for
adding Objects
HOW DO I CONVERT A FRIGGIN Object INTO a String?!?!?!

There is NOTHING on msdn.microsoft.com that shows how to convert objects.
The CStr function requires a String or String type data to work. And
AppendChunk requires String Data to work. And Microsoft's GREAT FRIGGIN
Example with the AppendChunk method is a Copy of an existing Object into a
new Field. Lot of FRIGGIN Help that was.

Some times being a programmer seems like a shortcut to the insane asylum.

Jay Moritz
 
P.S. Here's my existing code:

**** - Start - ****
Public Sub MakeChart()
Dim rsChart As DAO.Recordset
Dim objGraph As Object
Dim strGraph As String

Set rsChart = CurrentDb.OpenRecordset("Benefits", dbOpenDynaset)
Set objGraph = CreateObject("MSGraph.Chart.8")

rsChart.MoveFirst
Do Until rsChart.EOF
objGraph.Activate
objGraph.ChartType = xlPie
objGraph.Application.DataSheet.Range("00:D3").ClearContents
objGraph.Application.DataSheet.Range("A0").Value = "Total Cost of
Benefits"
objGraph.Application.DataSheet.Range("B0").Value = "Annual Salary"
objGraph.Application.DataSheet.Range("01").Value =
rsChart.Fields("Name")
objGraph.Application.DataSheet.Range("A1").Value =
rsChart.Fields("ER TTL")
objGraph.Application.DataSheet.Range("A2").Value =
rsChart.Fields("Annl Salary")
objGraph.Application.DataSheet.Range("A1:A2").NumberFormat =
"$#,##0.00_);[Red]($#,##0.00)"
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Legend.Font.Bold = False
objGraph.PlotArea.Border.LineStyle = xlLineStyleNone
objGraph.PlotArea.Fill.Visible = 0
** strGraph = CStr(objGraph) ** Doesn't Work :(
rsChart.Edit
rsChart.Fields("Chart").AppendChunk strGraph
rsChart.Update
rsChart.MoveNext
Loop

End Sub
**** - End - ****
 
I don't have Access here to check, & I'm no expert on MS Graph. But I
imagine you would need to find a property of the Graph object which exposed
its OLE data - perhaps .OLEData. That is the data you would need to store, I
imagine.

HTH,
TC


Jay Moritz said:
P.S. Here's my existing code:

**** - Start - ****
Public Sub MakeChart()
Dim rsChart As DAO.Recordset
Dim objGraph As Object
Dim strGraph As String

Set rsChart = CurrentDb.OpenRecordset("Benefits", dbOpenDynaset)
Set objGraph = CreateObject("MSGraph.Chart.8")

rsChart.MoveFirst
Do Until rsChart.EOF
objGraph.Activate
objGraph.ChartType = xlPie
objGraph.Application.DataSheet.Range("00:D3").ClearContents
objGraph.Application.DataSheet.Range("A0").Value = "Total Cost of
Benefits"
objGraph.Application.DataSheet.Range("B0").Value = "Annual Salary"
objGraph.Application.DataSheet.Range("01").Value =
rsChart.Fields("Name")
objGraph.Application.DataSheet.Range("A1").Value =
rsChart.Fields("ER TTL")
objGraph.Application.DataSheet.Range("A2").Value =
rsChart.Fields("Annl Salary")
objGraph.Application.DataSheet.Range("A1:A2").NumberFormat =
"$#,##0.00_);[Red]($#,##0.00)"
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Legend.Font.Bold = False
objGraph.PlotArea.Border.LineStyle = xlLineStyleNone
objGraph.PlotArea.Fill.Visible = 0
** strGraph = CStr(objGraph) ** Doesn't Work :(
rsChart.Edit
rsChart.Fields("Chart").AppendChunk strGraph
rsChart.Update
rsChart.MoveNext
Loop

End Sub
**** - End - ****


Jay Moritz said:
I have an Access 2000 database running on WinXP Pro.

I need to loop through a bunch of records creating a MSGraph Chart object
with data from a couple of fields in the active record. I only have one step
I can't seem to do, or find out how to do.

I can loop through all the records
I can create the MSGraph Chart object, format it and insert the required
data.
I can edit the record, I know I have to use the AppendChunk method for
adding Objects
HOW DO I CONVERT A FRIGGIN Object INTO a String?!?!?!

There is NOTHING on msdn.microsoft.com that shows how to convert objects.
The CStr function requires a String or String type data to work. And
AppendChunk requires String Data to work. And Microsoft's GREAT FRIGGIN
Example with the AppendChunk method is a Copy of an existing Object into a
new Field. Lot of FRIGGIN Help that was.

Some times being a programmer seems like a shortcut to the insane asylum.

Jay Moritz
 
Not sure why I would need to expose the OLE data?!?! The MS Graph code works
fine. (Though I can't really test the result because I can't save the Object
into the Database Field)

The Issue here has NOTHING to do with what Object I'm using, it's that I
can't Convert ANY Object into a String so I can Save it into the Database!
There has GOT to be a way!! (Or do I need to go Postal on the VBA System
Architect in Redmond?!?!)


TC said:
I don't have Access here to check, & I'm no expert on MS Graph. But I
imagine you would need to find a property of the Graph object which exposed
its OLE data - perhaps .OLEData. That is the data you would need to store, I
imagine.

HTH,
TC


Jay Moritz said:
P.S. Here's my existing code:

**** - Start - ****
Public Sub MakeChart()
Dim rsChart As DAO.Recordset
Dim objGraph As Object
Dim strGraph As String

Set rsChart = CurrentDb.OpenRecordset("Benefits", dbOpenDynaset)
Set objGraph = CreateObject("MSGraph.Chart.8")

rsChart.MoveFirst
Do Until rsChart.EOF
objGraph.Activate
objGraph.ChartType = xlPie
objGraph.Application.DataSheet.Range("00:D3").ClearContents
objGraph.Application.DataSheet.Range("A0").Value = "Total Cost of
Benefits"
objGraph.Application.DataSheet.Range("B0").Value = "Annual Salary"
objGraph.Application.DataSheet.Range("01").Value =
rsChart.Fields("Name")
objGraph.Application.DataSheet.Range("A1").Value =
rsChart.Fields("ER TTL")
objGraph.Application.DataSheet.Range("A2").Value =
rsChart.Fields("Annl Salary")
objGraph.Application.DataSheet.Range("A1:A2").NumberFormat =
"$#,##0.00_);[Red]($#,##0.00)"
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Legend.Font.Bold = False
objGraph.PlotArea.Border.LineStyle = xlLineStyleNone
objGraph.PlotArea.Fill.Visible = 0
** strGraph = CStr(objGraph) ** Doesn't Work :(
rsChart.Edit
rsChart.Fields("Chart").AppendChunk strGraph
rsChart.Update
rsChart.MoveNext
Loop

End Sub
**** - End - ****


Jay Moritz said:
I have an Access 2000 database running on WinXP Pro.

I need to loop through a bunch of records creating a MSGraph Chart object
with data from a couple of fields in the active record. I only have
one
step
I can't seem to do, or find out how to do.

I can loop through all the records
I can create the MSGraph Chart object, format it and insert the required
data.
I can edit the record, I know I have to use the AppendChunk method for
adding Objects
HOW DO I CONVERT A FRIGGIN Object INTO a String?!?!?!

There is NOTHING on msdn.microsoft.com that shows how to convert objects.
The CStr function requires a String or String type data to work. And
AppendChunk requires String Data to work. And Microsoft's GREAT FRIGGIN
Example with the AppendChunk method is a Copy of an existing Object
into
 
You misunderstand me. You can not save "an object" into "a string". You need
to find a property, of the object, which exposes the object's savable data.

HTH,
TC


Jay Moritz said:
Not sure why I would need to expose the OLE data?!?! The MS Graph code works
fine. (Though I can't really test the result because I can't save the Object
into the Database Field)

The Issue here has NOTHING to do with what Object I'm using, it's that I
can't Convert ANY Object into a String so I can Save it into the Database!
There has GOT to be a way!! (Or do I need to go Postal on the VBA System
Architect in Redmond?!?!)


TC said:
I don't have Access here to check, & I'm no expert on MS Graph. But I
imagine you would need to find a property of the Graph object which exposed
its OLE data - perhaps .OLEData. That is the data you would need to
store,
I
imagine.

HTH,
TC


Jay Moritz said:
P.S. Here's my existing code:

**** - Start - ****
Public Sub MakeChart()
Dim rsChart As DAO.Recordset
Dim objGraph As Object
Dim strGraph As String

Set rsChart = CurrentDb.OpenRecordset("Benefits", dbOpenDynaset)
Set objGraph = CreateObject("MSGraph.Chart.8")

rsChart.MoveFirst
Do Until rsChart.EOF
objGraph.Activate
objGraph.ChartType = xlPie
objGraph.Application.DataSheet.Range("00:D3").ClearContents
objGraph.Application.DataSheet.Range("A0").Value = "Total Cost of
Benefits"
objGraph.Application.DataSheet.Range("B0").Value = "Annual Salary"
objGraph.Application.DataSheet.Range("01").Value =
rsChart.Fields("Name")
objGraph.Application.DataSheet.Range("A1").Value =
rsChart.Fields("ER TTL")
objGraph.Application.DataSheet.Range("A2").Value =
rsChart.Fields("Annl Salary")
objGraph.Application.DataSheet.Range("A1:A2").NumberFormat =
"$#,##0.00_);[Red]($#,##0.00)"
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Legend.Font.Bold = False
objGraph.PlotArea.Border.LineStyle = xlLineStyleNone
objGraph.PlotArea.Fill.Visible = 0
** strGraph = CStr(objGraph) ** Doesn't Work :(
rsChart.Edit
rsChart.Fields("Chart").AppendChunk strGraph
rsChart.Update
rsChart.MoveNext
Loop

End Sub
**** - End - ****


I have an Access 2000 database running on WinXP Pro.

I need to loop through a bunch of records creating a MSGraph Chart object
with data from a couple of fields in the active record. I only have one
step
I can't seem to do, or find out how to do.

I can loop through all the records
I can create the MSGraph Chart object, format it and insert the required
data.
I can edit the record, I know I have to use the AppendChunk method for
adding Objects
HOW DO I CONVERT A FRIGGIN Object INTO a String?!?!?!

There is NOTHING on msdn.microsoft.com that shows how to convert objects.
The CStr function requires a String or String type data to work. And
AppendChunk requires String Data to work. And Microsoft's GREAT FRIGGIN
Example with the AppendChunk method is a Copy of an existing Object
into
a
new Field. Lot of FRIGGIN Help that was.

Some times being a programmer seems like a shortcut to the insane asylum.

Jay Moritz
 
Not being rude TC, but STOP! You are NOT helping! You have stated yourself
that you don't even have Access.

MS Access VBA requires that inserting Objects into a field in a table the
programmer must use the AppendChunk Method, Does ANY ONE Out there know how
to do this? The AppendChunk Method takes String data as it's argument.

PLEASE, I need Real Help with this.
Jay A. Moritz

TC said:
You misunderstand me. You can not save "an object" into "a string". You need
to find a property, of the object, which exposes the object's savable data.

HTH,
TC


Jay Moritz said:
Not sure why I would need to expose the OLE data?!?! The MS Graph code works
fine. (Though I can't really test the result because I can't save the Object
into the Database Field)

The Issue here has NOTHING to do with what Object I'm using, it's that I
can't Convert ANY Object into a String so I can Save it into the Database!
There has GOT to be a way!! (Or do I need to go Postal on the VBA System
Architect in Redmond?!?!)


TC said:
I don't have Access here to check, & I'm no expert on MS Graph. But I
imagine you would need to find a property of the Graph object which exposed
its OLE data - perhaps .OLEData. That is the data you would need to
store,
I
imagine.

HTH,
TC


P.S. Here's my existing code:

**** - Start - ****
Public Sub MakeChart()
Dim rsChart As DAO.Recordset
Dim objGraph As Object
Dim strGraph As String

Set rsChart = CurrentDb.OpenRecordset("Benefits", dbOpenDynaset)
Set objGraph = CreateObject("MSGraph.Chart.8")

rsChart.MoveFirst
Do Until rsChart.EOF
objGraph.Activate
objGraph.ChartType = xlPie
objGraph.Application.DataSheet.Range("00:D3").ClearContents
objGraph.Application.DataSheet.Range("A0").Value = "Total
Cost
of
Benefits"
objGraph.Application.DataSheet.Range("B0").Value = "Annual Salary"
objGraph.Application.DataSheet.Range("01").Value =
rsChart.Fields("Name")
objGraph.Application.DataSheet.Range("A1").Value =
rsChart.Fields("ER TTL")
objGraph.Application.DataSheet.Range("A2").Value =
rsChart.Fields("Annl Salary")
objGraph.Application.DataSheet.Range("A1:A2").NumberFormat =
"$#,##0.00_);[Red]($#,##0.00)"
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Legend.Font.Bold = False
objGraph.PlotArea.Border.LineStyle = xlLineStyleNone
objGraph.PlotArea.Fill.Visible = 0
** strGraph = CStr(objGraph) ** Doesn't Work :(
rsChart.Edit
rsChart.Fields("Chart").AppendChunk strGraph
rsChart.Update
rsChart.MoveNext
Loop

End Sub
**** - End - ****


I have an Access 2000 database running on WinXP Pro.

I need to loop through a bunch of records creating a MSGraph Chart
object
with data from a couple of fields in the active record. I only
have
one
step
I can't seem to do, or find out how to do.

I can loop through all the records
I can create the MSGraph Chart object, format it and insert the required
data.
I can edit the record, I know I have to use the AppendChunk method for
adding Objects
HOW DO I CONVERT A FRIGGIN Object INTO a String?!?!?!

There is NOTHING on msdn.microsoft.com that shows how to convert
objects.
The CStr function requires a String or String type data to work. And
AppendChunk requires String Data to work. And Microsoft's GREAT FRIGGIN
Example with the AppendChunk method is a Copy of an existing
Object
into
a
new Field. Lot of FRIGGIN Help that was.

Some times being a programmer seems like a shortcut to the insane
asylum.

Jay Moritz
 
No need to go ballistic on TC. He's only trying to help you. I think you are
missing a step. You need to use the GetChunk method prior to the AppendChunk
method. Search VBA Help for AppendChunk. There is an example there that may
be helpful to you.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Jay Moritz said:
Not being rude TC, but STOP! You are NOT helping! You have stated yourself
that you don't even have Access.

MS Access VBA requires that inserting Objects into a field in a table the
programmer must use the AppendChunk Method, Does ANY ONE Out there know how
to do this? The AppendChunk Method takes String data as it's argument.

PLEASE, I need Real Help with this.
Jay A. Moritz

You misunderstand me. You can not save "an object" into "a string". You need
to find a property, of the object, which exposes the object's savable data.

HTH,
TC


Jay Moritz said:
Not sure why I would need to expose the OLE data?!?! The MS Graph code works
fine. (Though I can't really test the result because I can't save the Object
into the Database Field)

The Issue here has NOTHING to do with what Object I'm using, it's that I
can't Convert ANY Object into a String so I can Save it into the Database!
There has GOT to be a way!! (Or do I need to go Postal on the VBA System
Architect in Redmond?!?!)


I don't have Access here to check, & I'm no expert on MS Graph. But I
imagine you would need to find a property of the Graph object which
exposed
its OLE data - perhaps .OLEData. That is the data you would need to store,
I
imagine.

HTH,
TC


P.S. Here's my existing code:

**** - Start - ****
Public Sub MakeChart()
Dim rsChart As DAO.Recordset
Dim objGraph As Object
Dim strGraph As String

Set rsChart = CurrentDb.OpenRecordset("Benefits", dbOpenDynaset)
Set objGraph = CreateObject("MSGraph.Chart.8")

rsChart.MoveFirst
Do Until rsChart.EOF
objGraph.Activate
objGraph.ChartType = xlPie
objGraph.Application.DataSheet.Range("00:D3").ClearContents
objGraph.Application.DataSheet.Range("A0").Value = "Total Cost
of
Benefits"
objGraph.Application.DataSheet.Range("B0").Value = "Annual
Salary"
objGraph.Application.DataSheet.Range("01").Value =
rsChart.Fields("Name")
objGraph.Application.DataSheet.Range("A1").Value =
rsChart.Fields("ER TTL")
objGraph.Application.DataSheet.Range("A2").Value =
rsChart.Fields("Annl Salary")
objGraph.Application.DataSheet.Range("A1:A2").NumberFormat =
"$#,##0.00_);[Red]($#,##0.00)"
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Legend.Font.Bold = False
objGraph.PlotArea.Border.LineStyle = xlLineStyleNone
objGraph.PlotArea.Fill.Visible = 0
** strGraph = CStr(objGraph) ** Doesn't Work :(
rsChart.Edit
rsChart.Fields("Chart").AppendChunk strGraph
rsChart.Update
rsChart.MoveNext
Loop

End Sub
**** - End - ****


I have an Access 2000 database running on WinXP Pro.

I need to loop through a bunch of records creating a MSGraph Chart
object
with data from a couple of fields in the active record. I only have
one
step
I can't seem to do, or find out how to do.

I can loop through all the records
I can create the MSGraph Chart object, format it and insert the
required
data.
I can edit the record, I know I have to use the AppendChunk
method
for
adding Objects
HOW DO I CONVERT A FRIGGIN Object INTO a String?!?!?!

There is NOTHING on msdn.microsoft.com that shows how to convert
objects.
The CStr function requires a String or String type data to work. And
AppendChunk requires String Data to work. And Microsoft's GREAT
FRIGGIN
Example with the AppendChunk method is a Copy of an existing Object
into
a
new Field. Lot of FRIGGIN Help that was.

Some times being a programmer seems like a shortcut to the insane
asylum.

Jay Moritz
 
You are being rude and just plain stupid as well.

PLONK!

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Jay Moritz said:
Not being rude TC, but STOP! You are NOT helping! You have stated yourself
that you don't even have Access.

MS Access VBA requires that inserting Objects into a field in a table the
programmer must use the AppendChunk Method, Does ANY ONE Out there know how
to do this? The AppendChunk Method takes String data as it's argument.

PLEASE, I need Real Help with this.
Jay A. Moritz

You misunderstand me. You can not save "an object" into "a string".
You
need
to find a property, of the object, which exposes the object's
savable
data.

HTH,
TC


code
works the
Object to
store,
"Total
Cost
of
Benefits"
objGraph.Application.DataSheet.Range("B0").Value = "Annual
Salary"
objGraph.Application.DataSheet.Range("01").Value =
rsChart.Fields("Name")
objGraph.Application.DataSheet.Range("A1").Value =
rsChart.Fields("ER TTL")
objGraph.Application.DataSheet.Range("A2").Value =
rsChart.Fields("Annl Salary")
objGraph.Application.DataSheet.Range("A1:A2").NumberFormat =
"$#,##0.00_);[Red]($#,##0.00)"
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Legend.Font.Bold = False
objGraph.PlotArea.Border.LineStyle = xlLineStyleNone
objGraph.PlotArea.Fill.Visible = 0
** strGraph = CStr(objGraph) ** Doesn't Work :(
rsChart.Edit
rsChart.Fields("Chart").AppendChunk strGraph
rsChart.Update
rsChart.MoveNext
Loop

End Sub
**** - End - ****


I have an Access 2000 database running on WinXP Pro.

I need to loop through a bunch of records creating a MSGraph Chart
object
with data from a couple of fields in the active record. I
only
have method
for
work.
 
I believe TC said that he didn't have ACCESS at the computer where he was,
not that he doesn't have ACCESS. I also think TC has tried to point you in a
valid direction.

I state up front that I have not worked with OLE objects in any significant
way, so my help will be limited to pointing you to some resources that may
assist you.

Per the Help files, AppendChunk is used to copy an OLE data field in one
table from an OLE data field in another table. It doesn't appear to me to be
a way to save an OLE object into a table's field.

You may wish to review the Action property of an OLE field in a table for
actions that can be done with an OLE object, including saving things into
OLE fields. For example, see this Knowledge Base article (ACC: How to Load
OLE Objects from a Folder into a Table - article #158941) for related
(though not directly what you seek to do) information:
http://support.microsoft.com/?id=158941


--
Ken Snell
<MS ACCESS MVP>


Jay Moritz said:
Not being rude TC, but STOP! You are NOT helping! You have stated yourself
that you don't even have Access.

MS Access VBA requires that inserting Objects into a field in a table the
programmer must use the AppendChunk Method, Does ANY ONE Out there know how
to do this? The AppendChunk Method takes String data as it's argument.

PLEASE, I need Real Help with this.
Jay A. Moritz

You misunderstand me. You can not save "an object" into "a string". You need
to find a property, of the object, which exposes the object's savable data.

HTH,
TC


Jay Moritz said:
Not sure why I would need to expose the OLE data?!?! The MS Graph code works
fine. (Though I can't really test the result because I can't save the Object
into the Database Field)

The Issue here has NOTHING to do with what Object I'm using, it's that I
can't Convert ANY Object into a String so I can Save it into the Database!
There has GOT to be a way!! (Or do I need to go Postal on the VBA System
Architect in Redmond?!?!)


I don't have Access here to check, & I'm no expert on MS Graph. But I
imagine you would need to find a property of the Graph object which
exposed
its OLE data - perhaps .OLEData. That is the data you would need to store,
I
imagine.

HTH,
TC


P.S. Here's my existing code:

**** - Start - ****
Public Sub MakeChart()
Dim rsChart As DAO.Recordset
Dim objGraph As Object
Dim strGraph As String

Set rsChart = CurrentDb.OpenRecordset("Benefits", dbOpenDynaset)
Set objGraph = CreateObject("MSGraph.Chart.8")

rsChart.MoveFirst
Do Until rsChart.EOF
objGraph.Activate
objGraph.ChartType = xlPie
objGraph.Application.DataSheet.Range("00:D3").ClearContents
objGraph.Application.DataSheet.Range("A0").Value = "Total Cost
of
Benefits"
objGraph.Application.DataSheet.Range("B0").Value = "Annual
Salary"
objGraph.Application.DataSheet.Range("01").Value =
rsChart.Fields("Name")
objGraph.Application.DataSheet.Range("A1").Value =
rsChart.Fields("ER TTL")
objGraph.Application.DataSheet.Range("A2").Value =
rsChart.Fields("Annl Salary")
objGraph.Application.DataSheet.Range("A1:A2").NumberFormat =
"$#,##0.00_);[Red]($#,##0.00)"
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Legend.Font.Bold = False
objGraph.PlotArea.Border.LineStyle = xlLineStyleNone
objGraph.PlotArea.Fill.Visible = 0
** strGraph = CStr(objGraph) ** Doesn't Work :(
rsChart.Edit
rsChart.Fields("Chart").AppendChunk strGraph
rsChart.Update
rsChart.MoveNext
Loop

End Sub
**** - End - ****


I have an Access 2000 database running on WinXP Pro.

I need to loop through a bunch of records creating a MSGraph Chart
object
with data from a couple of fields in the active record. I only have
one
step
I can't seem to do, or find out how to do.

I can loop through all the records
I can create the MSGraph Chart object, format it and insert the
required
data.
I can edit the record, I know I have to use the AppendChunk
method
for
adding Objects
HOW DO I CONVERT A FRIGGIN Object INTO a String?!?!?!

There is NOTHING on msdn.microsoft.com that shows how to convert
objects.
The CStr function requires a String or String type data to work. And
AppendChunk requires String Data to work. And Microsoft's GREAT
FRIGGIN
Example with the AppendChunk method is a Copy of an existing Object
into
a
new Field. Lot of FRIGGIN Help that was.

Some times being a programmer seems like a shortcut to the insane
asylum.

Jay Moritz
 
I seem to be really copping it lately!

Rather annoying when one is only trying to help :-(

Cheers,
TC


Stephen Lebans said:
You are being rude and just plain stupid as well.

PLONK!

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Jay Moritz said:
Not being rude TC, but STOP! You are NOT helping! You have stated yourself
that you don't even have Access.

MS Access VBA requires that inserting Objects into a field in a table the
programmer must use the AppendChunk Method, Does ANY ONE Out there know how
to do this? The AppendChunk Method takes String data as it's argument.

PLEASE, I need Real Help with this.
Jay A. Moritz

You misunderstand me. You can not save "an object" into "a string".
You
need
to find a property, of the object, which exposes the object's
savable
data.

HTH,
TC


Not sure why I would need to expose the OLE data?!?! The MS Graph code
works
fine. (Though I can't really test the result because I can't save the
Object
into the Database Field)

The Issue here has NOTHING to do with what Object I'm using, it's that I
can't Convert ANY Object into a String so I can Save it into the Database!
There has GOT to be a way!! (Or do I need to go Postal on the VBA System
Architect in Redmond?!?!)


I don't have Access here to check, & I'm no expert on MS Graph. But I
imagine you would need to find a property of the Graph object which
exposed
its OLE data - perhaps .OLEData. That is the data you would need to
store,
I
imagine.

HTH,
TC


P.S. Here's my existing code:

**** - Start - ****
Public Sub MakeChart()
Dim rsChart As DAO.Recordset
Dim objGraph As Object
Dim strGraph As String

Set rsChart = CurrentDb.OpenRecordset("Benefits", dbOpenDynaset)
Set objGraph = CreateObject("MSGraph.Chart.8")

rsChart.MoveFirst
Do Until rsChart.EOF
objGraph.Activate
objGraph.ChartType = xlPie
objGraph.Application.DataSheet.Range("00:D3").ClearContents
objGraph.Application.DataSheet.Range("A0").Value =
"Total
Cost
of
Benefits"
objGraph.Application.DataSheet.Range("B0").Value = "Annual
Salary"
objGraph.Application.DataSheet.Range("01").Value =
rsChart.Fields("Name")
objGraph.Application.DataSheet.Range("A1").Value =
rsChart.Fields("ER TTL")
objGraph.Application.DataSheet.Range("A2").Value =
rsChart.Fields("Annl Salary")
objGraph.Application.DataSheet.Range("A1:A2").NumberFormat =
"$#,##0.00_);[Red]($#,##0.00)"
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Application.DataSheet.Columns(4).Delete
objGraph.Legend.Font.Bold = False
objGraph.PlotArea.Border.LineStyle = xlLineStyleNone
objGraph.PlotArea.Fill.Visible = 0
** strGraph = CStr(objGraph) ** Doesn't Work :(
rsChart.Edit
rsChart.Fields("Chart").AppendChunk strGraph
rsChart.Update
rsChart.MoveNext
Loop

End Sub
**** - End - ****


I have an Access 2000 database running on WinXP Pro.

I need to loop through a bunch of records creating a MSGraph Chart
object
with data from a couple of fields in the active record. I
only
have
one
step
I can't seem to do, or find out how to do.

I can loop through all the records
I can create the MSGraph Chart object, format it and insert the
required
data.
I can edit the record, I know I have to use the AppendChunk method
for
adding Objects
HOW DO I CONVERT A FRIGGIN Object INTO a String?!?!?!

There is NOTHING on msdn.microsoft.com that shows how to convert
objects.
The CStr function requires a String or String type data to
work.
And
AppendChunk requires String Data to work. And Microsoft's GREAT
FRIGGIN
Example with the AppendChunk method is a Copy of an existing Object
into
a
new Field. Lot of FRIGGIN Help that was.

Some times being a programmer seems like a shortcut to the insane
asylum.

Jay Moritz
 
Back
Top