VBA for OnClick Open the image in a window

qnikchen

Registered User.
Local time
Today, 04:08
Joined
May 2, 2013
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 and it will change, according to the selection in the combobox. 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.

Thanks, any help or suggestion would be very appreciatted.
 
in the other form make the image object bigger .. then on the properties of the image SIZE MODE: STRETCH ... think it will do the trick
 
yes as deanvilar says, change the SizeMode property to make the image appearnance more acceptable.

As for opening another form to display the image larger, first create the other form (lets call it frmImagePopUp). Then on your current form add code to the image controls OnClick event to open frmImagePopUp.

DoCmd.OpenForm "frmImagePopUp",,,"ImageID=" & ImageID

ImageID is the name of the field that refers to your image
 
Thanks deanvilar, and Isskint,

I have trying to do what you guys have mentioned to me. I have created a form with the exact name, and in it I have added the field of the image (the image are in the database as a attachment file. The name of the field is Materials Mapping. But when I insert the code that you have mentioned with changing the name
Code:
 DoCmd.OpenForm "frmImagePopUp",,,"Materials Mapping=" & Materials Mapping
it does not work. It gives me the error of Syntax error (missing operator) in query expression 'Materials Mapping='. Can you please help me to figure out this. I am not very familiar with vba code in Access.

Thank you so much again
 
Is Materials Mapping a text or number field? If it si text then you need to use quotes ' '. Also if you have spaces in your field names you need to handle them properly, either 'join' the parts with _ or enclose in object brackets [ ].

DoCmd.OpenForm "frmImagePopUp",,,"[Materials Mapping]='" & [Materials Mapping] & "'"

DoCmd.OpenForm "frmImagePopUp",,,"Materials_Mapping='" & Materials_Mapping & "'"
 
Hi Isskint,

Thanks for replying back to me so quickly. I have tried your code and it did not work, and I think that I might have been not explainning very well. My table has the field Materials Mapping, which is a attachment type. In my form, what I did, I dragged the field into it, and then it can be seen the picture in the form. The picture in the form will be changing according to the combobox selection. The comboxbox name is Vendor. I have doing research on the internet, and I have found that you need to specify the comboxbox name
Code:
DoCmd.OpenForm "frmImagePopUp",,,"[Materials Mapping]='" & Vendor.value
and I think that it should be like this.
Do you have any other suggestion?

Sorry for asking so much.

Thank you again
 

Users who are viewing this thread

Back
Top Bottom