Insert into unbound object frame on report a bmp image stored in an ole object field in the db

JohnPapa

Registered User.
Local time
Today, 19:15
Joined
Aug 15, 2010
Messages
1,117
The bmp image is stored in the ACE db in an OLE control. It appears in a bound object frame on a report no problem.

Is there a way to use an unbound object frame and select the bmp image from the db?

One workaround is to include in the RecordSource of the report the table that includes the bmp image
 
Last edited:
Can you use DLookup() as an expression for it's source?
 
Not sure the answer to the question, but you could also try using a subreport.
 
Code:
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)

    If Me.LogoPath & "" = "" Then
    Else
        Me.imgLogo.Picture = Me.LogoPath
    End If
End Sub
This code uses an image control to fill in a logo. In the query, the company table is included so that the logoPath for the company whose report is being printed is in the bound recordset. I don't use embedded images, I use file names or complete path + filename. You could try the same code with an object but I'm not sure why you don't want to use a bound object frame in that case.
 
Code:
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)

    If Me.LogoPath & "" = "" Then
    Else
        Me.imgLogo.Picture = Me.LogoPath
    End If
End Sub
This code uses an image control to fill in a logo. In the query, the company table is included so that the logoPath for the company whose report is being printed is in the bound recordset. I don't use embedded images, I use file names or complete path + filename. You could try the same code with an object but I'm not sure why you don't want to use a bound object frame in that case.
Hi Pat, I am aware of the fact that I could pass the pathname.

In my case we are talking about a few images and it is more manageable to store them in the db.
 
So, why aren't you using a bound control, did you try the code I posted using a reference to the object instead of the path? If it doesn't work with the image control, try the unbound object frame.
 
So, why aren't you using a bound control, did you try the code I posted using a reference to the object instead of the path? If it doesn't work with the image control, try the unbound object frame.
Hi Pat did you post code with a reference to the object?
 
Whatever your field and control names are. Try the obvious solution first. I told you that my code works using an image control and a path. I don't store OLE objects in ACE databases due to bloat. I don't know that the code I use doesn't work exactly the same way if you reference a column from your bound recordsource but that begs the question of, why not use a bound control if the object is stored in a table.

I don't have a table with OLE objects so I don't have anything to test with.
 
Whatever your field and control names are. Try the obvious solution first. I told you that my code works using an image control and a path. I don't store OLE objects in ACE databases due to bloat. I don't know that the code I use doesn't work exactly the same way if you reference a column from your bound recordsource but that begs the question of, why not use a bound control if the object is stored in a table.

I don't have a table with OLE objects so I don't have anything to test with.
I believe I tried that and was not successful. Will try again.

As I have mentioned there is no problem with using the pathname. The specific file is a representation of a signature and would prefer that this is stored inside the db and not on the disk. There will no bloating since we are talking about 1 or 2 signatures per db.
 
Again, I ask, why are you not using a bound control? Assuming the ID for the signature is in the table because if it isn't, how are you going to figure out what signature to use anyway, you can join the data table to the signature table on the SignatureID and just use a bound control that requires NO CODE.
 
Again, I ask, why are you not using a bound control?
As I have mentioned above, I am using a bound control and the workaround so far is to include the table which includes the .bmp, as indicated by the sample code below for the report where oleSignature is the image

Code:
Me.RecordSource = "SELECT tblDoctor.lngDoctorID, tblDoctor.oleSignature " _
& " FROM tblDoctor " _
& " WHERE ((tblDoctor.lngDoctorID = " & lngDentist & ")) ;"

Assuming the ID for the signature is in the table because if it isn't, how are you going to figure out what signature to use anyway, you can join the data table to the signature table on the SignatureID and just use a bound control that requires NO CODE.
My question is how to manipulate an image stored in the db and place it on an unbound control
 
Have the bound field for the image hidden and refer to that in the unbound control?
 
Have the bound field for the image hidden and refer to that in the unbound control?
Couldn't we just hide/show the bound control? Is there a need for the unbound control? Not sure I understand.
 
You just said
My question is how to manipulate an image stored in the db and place it on an unbound control
You seem to not want to use a bound control for some reason?, so my suggestion was a compromise, so to speak.
You get the image automatically in the bound control and just refer to that control in the unbound control?

Seems pointless to me TBH, but just trying to see if that would solve your needs?
 
You just said

You seem to not want to use a bound control for some reason?, so my suggestion was a compromise, so to speak.
You get the image automatically in the bound control and just refer to that control in the unbound control?

Seems pointless to me TBH, but just trying to see if that would solve your needs?
I was merely trying to understand how an image stored in the db is referenced and placed on an unbound control.

As I mention above, I am using a bound control without a problem.
 
I was merely trying to understand how an image stored in the db is referenced and placed on an unbound control.

As I mention above, I am using a bound control without a problem.
I mentioned a Dlookup() many posts ago, did you try that?
 
Are you using the attachment data type to store the image? That could be the entire problem. It requires special code to manipulate it. If you never have more than a single image for a record and since these are signatures, why would you?, then there is no reason whatsoever to use the attachment data type. Just use the OLE type.
 
I mentioned a Dlookup() many posts ago, did you try that?
I just tried Dlookup and it works. I intend to use it and is preferable to complicating the existing complicated queries.
Thanks, belatedly.
 

Users who are viewing this thread

Back
Top Bottom