code for OnClick zoom a image

fibonacci

Registered User.
Local time
Today, 03:33
Joined
May 5, 2015
Messages
13
Hi Everyone,

I am new to VBA for access. I am working on a form as a user interface. I have added an picture to the form. It looks small, and not clear because of the size, and each image has different size. I would like to know if there is a VBA code that will allow me to click on it, and then it will open in another window so it is bigger with the right sizes.
I attempted like this:
Code:
DoCmd.OpenForm "Prova", , , "Campo1=" & Campo1
but don't work
Prova is another form and Campo1 is the field with the picture.

I also need to save about 120,000 images.
I wonder if the best solution is to use the attachment for the field type or another.
What format should I Whereas in the mask I preview. And if Acces internally saves the images or not

Thanks in advance, any help or suggestion would be very appreciatted.
 
Here is an Example:
PHP:
Dim strFormName As String
    Dim strCriteria As String
    
   If IsNull(Me.ProductID) Then         'No Product Entered Yet For Picture to be Displayed.
   MsgBox "You Must Enter a Product First Then Add a Picture"
   Exit Sub
   End If
   
    
   strFormName = "frmProductPicture"
   strCriteria = "[ProductID] = " & Me![ProductID]
   DoCmd.OpenForm strFormName, acViewNormal, , strCriteria
 
Firstly I would avoid using the Attachment field as Access is limited to 2GB and you won't get anywhere near uploading 120,000 images before you get a 'Cannot open database' error.

Instead I would use the image control and create a link field in your table that contains a location for the image, then use that link field as the control source for you image.
 
Here is an Example:
PHP:
Dim strFormName As String
    Dim strCriteria As String
    
   If IsNull(Me.ProductID) Then         'No Product Entered Yet For Picture to be Displayed.
   MsgBox "You Must Enter a Product First Then Add a Picture"
   Exit Sub
   End If
   
    
   strFormName = "frmProductPicture"
   strCriteria = "[ProductID] = " & Me![ProductID]
   DoCmd.OpenForm strFormName, acViewNormal, , strCriteria

I wrote this code:
Code:
Private Sub Campo1_Click()
Dim strFormName As String
    Dim strCriteria As String
     
   If IsNull(Me.Campo1) Then         'No Product Entered Yet For Picture to be Displayed.
   MsgBox "You Must Enter a Product First Then Add a Picture"
   Exit Sub
   End If
    
     
   strFormName = "Prova"
   strCriteria = "[Campo1] = " & Me![Campo1]
   DoCmd.OpenForm strFormName, acViewNormal, , strCriteria
End Sub

but I riceive run-time error 438
 

Users who are viewing this thread

Back
Top Bottom