reset image size for new record

Davros

Registered User.
Local time
Today, 03:28
Joined
Sep 9, 2005
Messages
131
hi
i have a database with hyperlinked images in a sub form that show a new image for every record. on this sub form i have a zoom in and zoom out button which is VB coded. the problem i have is that when i zoom in and then go to the next record the new image is still enlarged and has not reset to the size of the image box. any idea as to what i need to do to correct this. i think i need to put some VB code on the on current event but not sure what. any help would be appreciated

thanks
 
i'm thinking along the lines of a reset or resize command but as yet have had no joy in finding the correct code
anybody any ideas??
 
You would have to look at your code to see what it does to resize the image and then in OnCurrent set it back to its beginning values.

Larry
 
thanks for the reply
my zoom code is

Private Sub ZoomIn_Click()
Dim Hght As Integer
Dim Wdth As Integer

Hght = Forms!memorials!photo!cempic!.Height
Wdth = Forms!memorials!photo!cempic!.Width

Hght = Hght * 1.2
Wdth = Wdth * 1.2

Forms!memorials!photo!cempic!.Height = Hght
Forms!memorials!photo!cempic!.Width = Wdth
Exit Sub

if i click on the zoom command button 2 times it zooms in 2 times to the image. when i go onto the next record and image this image is still zoomed in 2 times. the latest code i have tried is as you suggested;

oncurrent
hght = hght * 1
wdth = wdth * 1

but of course i am only multiplying by 1 the image size as it exists in the new record therefor it will not resize. if i divide by say 1.2 on the oncurrent event then every time i load an image it will divided by the above number down to nothing.
i think i either need to come up with a code that says 'if i have zoomed in 2 times and i go onto a new record then zoom out 2 times' this would need some coding to count how many times i click the zoom button. or some coding that would automatically resize the image to the size of the image box.
any ideas?

thanks
 
What you have to do is define what the desired starting height and width are. Let's say you want each image to start out at 4 inches wide by 3 inches high. In Form_Current just put Me.cempic.Width=3 and Me.cempic.Height=3.
That way when you go to a new record it undoes any changes made by the zoom function.

Larry
 
thanks for the reply
i've tried that and the image disappears. any ideas why? [perhaps i have to define what me.cempic.height = 4 means??]

i've also tried

Me.cempic.ImageWidth = 3
Me.cempic.ImageHeight = 3

but i get the error message that this property is read only. [there is no read only property on the images themselves]
 
Last edited:
finally cracked it so i thought i'd pass on the answer to the above.

at the oncurrent event i needed to type the code

Me.Form!photo!cempic!.Height = 6500
Me.Form!photo!cempic!.Width = 5000

because the form showing the images is a subform.

the large numbers used are because access uses the measurement unit of 'twips' which equate to 567 twips to 1 cm. my image when i go onto the next record now resizes iteself to approx. 12cm * 9cm.
thanks to Laurentech for the pointers
 
Excellent! Glad you got it figured out. Thanks for posting the solution.

Larry
 

Users who are viewing this thread

Back
Top Bottom