command button open image

bugman

Registered User.
Local time
Yesterday, 18:30
Joined
Dec 23, 2004
Messages
31
Is it possible to have a cmdButton open a pre saved image from your hard drive. The images are saved with the same name as the Account Number. (ex: AcctNum -- TA123409 Image -- TA123409.bmp) I want the cmdButton to open the image filtered or based on the Account Number. If so, could someone show me a sample OnClick code. Thanks
 
one way -- use a hyperlink

Private Sub cmdOpenPicture_Click()
``Dim filespec As String

``'set filespec to the name of the file to open
``filespec = "C:\TA123409.bmp"

``'set the hyperlink address of the button
``Me.cmdOpenPicture.HyperlinkAddress = filespec

End Sub
 
First, thanks for your responce.
So your saying that there is no way to Filter the AccountNumber.Value or AccountNumber.Text to find the image you are looking for. Something like setting it up to where it looks for it in a certain folder like (C:\dbimages)
and then has the criteria of the text ---- [AccountNumber] & (.bmp) Like this.
 
There are thousands of Customers and one image for each Customer
 
oooooooohhh.....

I thought your question was centered on how to open the image.

So I'm guessing now because I know nothing about your data, but...
IF you have a form that has an AccountNumber control _
AND IF all your images are stored in a "c:\AccountImages\" directory _
AND IF all your images are have ".bmp" extensions _
THEN you can construct the 'filespec' string as follows:

filespec = "c:\AccountImages\" & Me.AccountNumber & ".bmp"
 
THANK YOU ................ :) That is exactly what I wanted.
Ok so if I have the Customer form up and I want to look at the image that is assigned to the Customer account number, I simply apply the code you supplied, to the OnClick event of a cmdButton and it will go and retrieve the image as long as it is in the folder specified and the format specified ie. .bmp.
 
aaahhhhhh, wellllll....

No guarantees. I can only offer a sort of oversimplified and theoretical 'here try this' blob of information, and your mission is see if you can make it work.
G'luck.
 
It works perfectly. Thank you!!!!!!!!!!!

PS: It was so simple to.
 

Users who are viewing this thread

Back
Top Bottom