[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

How can I use a stored property value to display an image pictureSizeMode?

I have an Attachment that I am displaying as an image on a form. That part works fine. I have a table that I store the picture Size Mode in. This field is in the record source of the form. The field is called LogoPicMode. The value stored is acOLESizeClip. I have attached what I have. The problem is I get Runtime Error 91 Object variable or WIth block variable not set..
Dim SizeType As String
SizeType = Me.LogoPicMode
Me.Attachments.PictureSizeMode = SizeType

Open in new window

0
seanlhall
Asked:
seanlhall
  • 6
  • 4
1 Solution
 
mbizupCommented:
<I have an Attachment that I am displaying as an image on a form.>

Are you dealing with an actual Attachment Field/Attachment Control?  Or just a picture control?

If it is the latter, I believe you need this:

Me.PictureSizeMode = SizeType


0
 
seanlhallAuthor Commented:
Is an attachment. What I have below does work. I would like to retrieve the value form my table

Me.Attachments.PictureSizeMode = acOLESizeClip

0
 
mbizupCommented:
Also, picturesizemode is integer, not string.

acOleSizeClip is a VB constant for 0.

Rather than storing the constant by name in your table, you may need to store it as a number (0)

and then change the code to this:

Me.Attachments.PictureSizeMode = Me.LogoPicMode

0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
mbizupCommented:
<I would like to retrieve the value form my table >

Got it :)

My last post should do the trick for you.

Store and use the PictureSizeMode as an integer, not a string.
0
 
seanlhallAuthor Commented:
I got the error Type Mismatch
0
 
seanlhallAuthor Commented:
I got it to work I changed the value stored to 0. What would stretch and zoom be then?
0
 
mbizupCommented:
This isn't permanent code, but test this:

Me.Attachments.PictureSizeMode = 0
0
 
mbizupCommented:
In response to your last post

Stretch: 1
Zoom: 3

You can find these though the immediate window at the bottom of the VB editor by typing this:

? acOLESizeClip

? acOLESizeZoom
etc
0
 
mbizupCommented:
Regarding my suggestion at http:#a36951984 to store the corresponding integer, you can also add a text column for the definition.

It wouldn't be used in the code of course, but it would make it more apparent to you and/or other developers what those numbers mean.
0
 
seanlhallAuthor Commented:
Thanks works great.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now