Go Back   Access World Forums > Microsoft Access Discussion > Macros

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 08-08-2018, 06:09 AM   #1
rghaddad@inco.com.lb
Newly Registered User
 
Join Date: Dec 2013
Posts: 16
Thanks: 5
Thanked 0 Times in 0 Posts
rghaddad@inco.com.lb is on a distinguished road
Images on Forms

Hello All,
Below is a Macro I wrote assigning a picture to an image box on a form.
it worked properly then stopped for no reason.
it is now generating runtime-error 2220

============================================

Private Sub Combo45_Change()
'This is the By Part Reference ComboBox
Dim SelectedPartName As Variant

If Not IsNull(DLookup("[PartPicture]", "Table_Stock", _
"[PartName]=[Forms]![Form_By_Products]![combo45]")) Then

SelectedPartName = DLookup("[PartPicture]", "Table_Stock", "[PartName]=[Forms]![Form_By_Products]![combo45]")

MsgBox ("Selected Part: " & SelectedPartName)
' On Error Resume Next
Image22.Picture = SelectedPartName
Else
MsgBox "No Image"
Image22.Picture = ""
End If
End Sub

rghaddad@inco.com.lb is offline   Reply With Quote
Old 08-08-2018, 06:22 AM   #2
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 6,353
Thanks: 54
Thanked 2,030 Times in 1,943 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Images on Forms

i am guessing [PartPicture] field holds the Path+PictureName.
see if the picture actually exists.
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
Old 08-08-2018, 06:31 AM   #3
rghaddad@inco.com.lb
Newly Registered User
 
Join Date: Dec 2013
Posts: 16
Thanks: 5
Thanked 0 Times in 0 Posts
rghaddad@inco.com.lb is on a distinguished road
Re: Images on Forms

indeed
attached is the reference table / table field
Attached Images
File Type: png C__Users_rgh_Dropbox_Roland_Databases_Spa.png (61.3 KB, 13 views)

rghaddad@inco.com.lb is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Images In Forms bretdunlap Forms 2 10-04-2012 01:11 PM
Forms & Images Hydra427 Forms 4 03-16-2012 08:10 AM
Forms / Images Dick7Access Forms 1 01-23-2011 04:41 PM
Printing multiple forms with linked images...How can I make the images work? hunterw Forms 0 10-03-2008 12:05 PM
Images in forms sush Forms 1 06-18-2001 06:31 AM




All times are GMT -8. The time now is 09:39 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World