Link Criteria

jmeek

Registered User.
Local time
Today, 03:50
Joined
Aug 16, 2005
Messages
38
Is there a way of formulating a link criteria on opening
a form whereby the link on the form is a file on disk
which has the same ID minus the .jpg.

So instead of this

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmImage"

stLinkCriteria = "[ProductID]=" & "'" & Me![txtProductID] & "'"
DoCmd.OpenForm stDocName

the Me![txtProductID] will be the jpg file on disk minus the extension
of course

If the ProductID is not = JpgID then the form doesn't open.
I need somehow to test for the existence of the file itself.

Do hope I have been clear enough
Look forward to some suggestions
 
Are you trying to display an image of the product on the form? If so, the recommended way is to use an UNBOUND Image control and set the Picture property of the control to the image using the On Current event.

Generally I do this with code like the following:

Code:
Dim strImagepath As String

strImagepath = the path to the image file either stored or generated

If DIR(strImagepath) = 0 Then
     Me!imgPic.Picture = default picture
Else
     Me!imgPic.Picture = strImagepath
End If
 
link criteria

ScottGem

I have no problem with opening the form that has
a picture on the hard disk and I am using something
similar to your code. All thats fine.
What I need to do is to prevent the form from opening
if the image for that product is not on the hard disk.
At the moment the form opens whether or not there is
an image.
So I need to check to see if the jpeg does in fact exisit
and if it doesn't, do not open the form.

Thanks
 

Users who are viewing this thread

Back
Top Bottom