Best way to design form to show occasional second image ?

E

envirographics

Hi, I have need to see occasionally a second large image on a form.
The images use the Linked property of an Image Control and coding in
Event > OnCurrent to point the control to the ImagePath.

I would like to have a button called 'Click for CloseUpImage' that
would temporarily show the second image, another button with this to
close it. A nice touch would be to have this first button not visible
when CloseUpImage field was Null.

How best could I achieve this, e.g. a pop up subForm ? I wish to see
the fields whilst seeing the second image ideally.
What do I have to add to the coding ? Would this be in the Private Sub
Form Current coding ?

The paths to the two images are both stored in the same table as for
the rest of the fields for the form. Both entry windows currently
reside on the main form, would one have to move to the popup
form,.e.g. when I have a second image, I click the aforementioned
button, and enter the path in that form, ah but the button would be
greyed out !..not so good an idea !

Please advise

coding by the way is:-
Private Sub Form_Current()
On Error Resume Next
If IsNull(Me![PathToImageFile]) Then
Me![ImageFrame].Visible = False
Else
Me![ImageFrame].Picture = Me![PathToImageFile]
Me![ImageFrame].Visible = True
End If

If IsNull(Me![PathToImageFileCloseUp]) Then
Me![CloseUpImageFrame].Visible = False
Else
Me![CloseUpImageFrame].Picture = Me![PathToImageFileCloseUp]
Me![CloseUpImageFrame].Visible = True
End If
End Sub

Private Sub PathToImageFile_AfterUpdate()
On Error Resume Next
If IsNull(Me![PathToImageFile]) Then
Me![ImageFrame].Visible = False
Else
Me![ImageFrame].Picture = Me![PathToImageFile]
Me![ImageFrame].Visible = True
End If

If IsNull(Me![PathToImageFileCloseUp]) Then
Me![CloseUpImageFrame].Visible = False
Else
Me![CloseUpImageFrame].Picture = Me![PathToImageFileCloseUp]
Me![CloseUpImageFrame].Visible = True
End If
End Sub


Cheers
Envirographics

Findit code Envirographics_images
 
B

ben_london1 via AccessMonster.com

Why not have all the controls you need on the one form but only have the
"permanent" ones visible, then when the user clicks the 'CloseUpImage'
button, it re-sizes the form and sets the hidden controls visible property
to TRUE. The user then presses the button to hide the large image, this
resizesthe form and sets the controls visible property to False, as
follows:

1) Add a command button to your form and call it cmd_CloseUpImage change
the caption to Close Up Image
2) Add a image to the form and call it img_CloseUp
3) If using a text box to typw the image path then add a text bow and call
it txt_ImagePath
4) Copy and paste the code below into you form

Option Compare Database

Private Sub cmd_CloseUpImage_Click()
Dim strCmdCap As String

'Get the command button caption
strCmdCap = Me.cmd_CloseUpImage.Caption

'call the proc and if errors then display a message
If ShowCloseUp(strCmdCap) = False Then
'Error message
MsgBox "Due to an error the close up image cannot be shown",
vbCritical
End If

End Sub

Function ShowCloseUp(p_strCmdCap As String) As Boolean

'Add some basic error handling
On Error GoTo Err_ShowCloseUp

Select Case p_strCmdCap

Case "Close Up Image"

With Me

'resize the form window
'Set using Twips (1440 twips equal 1 inch, 567 twips = 1 cm)
DoCmd.MoveSize , , 12000

'Set the image to link
.img_CloseUp.PictureType = 1

'Set the image path or you could get a string you've
entered into a textbox,
'or get the image from a table using DAO
'Delete code as appropriate
.img_CloseUp.Picture = "C:\..."
.img_CloseUp.Picture = IIf(IsNull(Me.txt_ImagePath), "",
Me.txt_ImagePath)

'show the image
.img_CloseUp.Visible = True

'Change the button caption
.cmd_CloseUpImage.Caption = "Normal View"

'Success
ShowCloseUp = True

End With

Case "Normal View"

With Me

'resize the form window
DoCmd.MoveSize , , 6000

'Re-set the image path
.img_CloseUp.Picture = ""
'or
'if using a textbox
.txt_ImagePath = ""

'hide the image
.img_CloseUp.Visible = False

'Change the button caption
.cmd_CloseUpImage.Caption = "Close Up Image"

'Success
ShowCloseUp = True

End With

End Select

Exit Function

'Error handling just resets the form
Err_ShowCloseUp:
ShowCloseUp = False
DoCmd.MoveSize , , 6000
Me.img_CloseUp.Picture = ""
Me.img_CloseUp.Visible = False
Me.cmd_CloseUpImage.Caption = "Close Up Image"

End Function
 
E

envirographics

Thanks Ben,
I shall try that, sounds a little involved but doing it no doubt will
make things clear.
What other options might there be .....anyone ?

Envirographics
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top