Hi All
Ive got an issue with inserting images into a command button from a table that I have embedded a OLE object into. The following is the code Im am trying to use; -
If bolMenuVisible Then
-
Me("Option" & rst![ItemNumber]).Visible = True
-
' Me("Option" & rst![ItemNumber]).Picture = rst![Icon] ' icon
-
' Me("Option" & rst![ItemNumber]).PictureData = cmd1.PictureData ' icon
-
Me("Option" & rst![ItemNumber]).PictureData = DLookup("IImage", "tblImage") ' icon
-
Me("OptionLabel" & rst![ItemNumber]).Visible = True
-
Me("OptionLabel" & rst![ItemNumber]).Caption = rst![ItemText]
-
-
Else
-
If (rst![ItemNumber] < 7) Or (rst![ItemNumber] > 9) Then
-
' Me("Option" & rst![ItemNumber]).Picture = rst![Icon] ' icon
-
' Me("Option" & rst![ItemNumber]).PictureData = cmd1.PictureData ' icon
-
Me("Option" & rst![ItemNumber]).PictureData = DLookup("IImage", "tblImage") ' icon
-
Me("Option" & rst![ItemNumber]).Visible = True
-
Me("OptionLabel" & rst![ItemNumber]).Visible = True
-
Me("OptionLabel" & rst![ItemNumber]).Caption = rst![ItemText]
-
End If
-
End If
-
However, this returns an error that the image is not a device independant bitmap (which it is). Any ideas?
5 3898
Try this ... -
If bolMenuVisible Then
-
Me("Option" & rst![ItemNumber]).Visible = True
-
Me("Option" & rst![ItemNumber]).Picture = "'" & rst![Icon] & "'"
-
Me("OptionLabel" & rst![ItemNumber]).Visible = True
-
Me("OptionLabel" & rst![ItemNumber]).Caption = "'" & rst![ItemText] & "'"
-
Else
-
If (rst![ItemNumber] < 7) Or (rst![ItemNumber] > 9) Then
-
Me("Option" & rst![ItemNumber]).Picture = "'" & rst![Icon] & "'"
-
Me("Option" & rst![ItemNumber]).Visible = True
-
Me("OptionLabel" & rst![ItemNumber]).Visible = True
-
Me("OptionLabel" & rst![ItemNumber]).Caption = "'" & rst![ItemText] & "'"
-
End If
-
End If
-
Mary
Try this ... -
If bolMenuVisible Then
-
Me("Option" & rst![ItemNumber]).Visible = True
-
Me("Option" & rst![ItemNumber]).Picture = "'" & rst![Icon] & "'"
-
Me("OptionLabel" & rst![ItemNumber]).Visible = True
-
Me("OptionLabel" & rst![ItemNumber]).Caption = "'" & rst![ItemText] & "'"
-
Else
-
If (rst![ItemNumber] < 7) Or (rst![ItemNumber] > 9) Then
-
Me("Option" & rst![ItemNumber]).Picture = "'" & rst![Icon] & "'"
-
Me("Option" & rst![ItemNumber]).Visible = True
-
Me("OptionLabel" & rst![ItemNumber]).Visible = True
-
Me("OptionLabel" & rst![ItemNumber]).Caption = "'" & rst![ItemText] & "'"
-
End If
-
End If
-
Mary
Hi Mary
Thanks for that. However, it doesnt seem to do want I want. Im trying to lookup an embedded OLE value from tblImage, and place it in a command button.
Me("Option" & rst![ItemNumber]).PictureData = DLookup("IImage", "tblImage")
When this is executed, it returns an error about incorrect picture format.
Thanks
Hi Mary
Thanks for that. However, it doesnt seem to do want I want. Im trying to lookup an embedded OLE value from tblImage, and place it in a command button.
Me("Option" & rst![ItemNumber]).PictureData = DLookup("IImage", "tblImage")
When this is executed, it returns an error about incorrect picture format.
Thanks
How are you identifying which image record to return. There is normally a third criteria statement on the DLookup function?
Can you give me an example of the embedded image file (i.e.) the value stored in the record.
Mary
How are you identifying which image record to return. There is normally a third criteria statement on the DLookup function?
Can you give me an example of the embedded image file (i.e.) the value stored in the record.
Mary
Even with the criteria set I still receive the same error (ie:)
Me("Option" & rst![ItemNumber]).PictureData = DLookup("IImage", "tblImage", "[IID] = 1")
The value stored in tblIImage is a .bmp file that I embedded in the table. The data type is OLE object, and I embedded simply by clicking insert new object.
Even with the criteria set I still receive the same error (ie:)
Me("Option" & rst![ItemNumber]).PictureData = DLookup("IImage", "tblImage", "[IID] = 1")
The value stored in tblIImage is a .bmp file that I embedded in the table. The data type is OLE object, and I embedded simply by clicking insert new object.
Picture data is still looking for a string value. Try ... - Me("Option" & rst![ItemNumber]).PictureData = "'" & DLookup("IImage", "tblImage", "[IID] = 1") & "'"
Failing this, open the bitmap in some image editing software and run save as to save the picture as a Windows Bitmap rather than any other type of bitmap just in case.
Change the OLE object from embedded to linked and see if that makes any difference.
The only other alternative (assuming the command button just can't reference an OLE object) is to create a bound OLE object on the form and change it to look like a command button. You should still be able to code a click event on it.
Mary
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Marko Poutiainen |
last post by:
Situation:
We had to make our SQLServer 2000 database multi-lingual. That is, certain
things (such as product names) in the database should be shown in the
language the user is using (Finnish,...
|
by: Charles Robinson III |
last post by:
How do I make Access display pictures within a form view as linked objects,
so that the pictures which I am linking to are displayed within the
database? I have a seperate folder for pictures to be...
|
by: Pedro Maria Ferro da Cunha |
last post by:
I spend a lot of time making 2 thousand pictures and saving them as an
article name. jpg.
I have a table with the article name and name of the file in jpg (format).
How can I make an...
|
by: Lyn |
last post by:
I am having a frustrating time trying to do a simple insert of a BMP picture
into a Bound Object Frame using both VBA and the Insert | Object... dialog.
I had a separate post thread going on this...
|
by: MLH |
last post by:
If I choose a command button on a form in design view,
open the properties box and click the Picture property
and its wiz button, I'm presented with a lengthy list of
pictures. Everything from Add...
|
by: pd123 |
last post by:
I'm new to C# and .net and I'm trying to create a form that will register users in a sql server database. I have the following code but when I run the code I get an error "
The name 'Peter' is...
|
by: rcoco |
last post by:
Hi,
I want to share this problem. I have a datagrid that will help me
Insert data into sql database. So I made a button On my form so that
when I press the button a new row on datagrid should be...
|
by: kashif khan |
last post by:
Hi All,
I have created a form in MSAccess and linked that form with a table.
now in the run mode if i am entering any thing in the textbox and closing the form with out clicking on add record...
|
by: Clamato |
last post by:
Good Morning,
I'm working with a form that basically add's a users windows logon ID, first name, and last name to a table. A list box on this form is then requeried once added displaying the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |