MS Access/VB6 & XML (Trying to add a dynamic Image in my report)

01-12-2004, 06:16 AM
Hello all,

First post I hope I have the right forum.

I have a VB form with several controls on, one of the controls takes an XML report file and shows the data as a printable document.

The problem im having is binding the image to the picture field in the XML through the VB code on my form.
I have very little to no experience with XML although it seems familiar to HTML.
In the XML file the code that displays the image is as follows:


As you see I have inserted the var 'picone' in the hope I could replace that with the correct path with the code on the VB form:

Private Sub Command1_Click()
Dim picone
Dim strConnect
picone = App.Path & "\pictures\no_pic.gif"
strConnect = ";DATABASE=" & App.Path & "\mydb.mdb" & _
' make sure we have a report selected
On Error Resume Next
If cmbReport.ListIndex < 0 Then
MsgBox "Please Select A Report From The List Box"
Exit Sub
End If

' no reentrancy
If vsr.IsBusy Then Exit Sub

' prepare to benchmark
Dim t
t = Timer
MousePointer = 11

' open DAO recordset
' ** note:
' We use vsr.DataSource.GetRecordSource(True) instead of
' vsr.DataSource.RecordSource to handle parameter queries.
' If the original RecordSource value contains a PARAMETERS
' clause, GetRecordSource prompts the user for the parameters
' and replaces them with their values.
Dim strRecordSource As String
strRecordSource = vsr.DataSource.GetRecordSource(True)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = OpenDatabase("", False, False, strConnect)
strRecordSource = Replace(strRecordSource, "picone", picone)
Set rs = db.OpenRecordset(vsr.DataSource.GetRecordSource(True), dbOpenDynaset)

' assign DAO recordset to vsr control
vsr.DataSource.Recordset = rs
' render report
On Error Resume Next
vsr.Render vp
If Err.Number <> 0 Then
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
End If

' close DAO recordset
Set rs = Nothing

End Sub

Thanks to any one who can help me.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum