Images in Access

BillyMac

Registered User.
Local time
Today, 07:46
Joined
Feb 27, 2004
Messages
24
With reference to this post

Oldsoftboss said:
How to link images in your database. Uses the common dialog box to store the image path. Shows how to display, zoom as well as print.

A2000 format

I have tried the the code in your Imagesample2000 on my form to solve the problem of an image remaining from the previous record. The code I used is:

Code:
Private Sub Form_Current()
  
If Not IsNull([ImagePath]) Then
    Forms!QPaperAdminForm!LargeImageForm![ImageFrame].Picture = [ImagePath]
    SysCmd acSysCmdSetStatus, "Image: '" & [ImagePath] & "'."
  Else
    Forms!QPaperAdminForm!LargeImageForm![ImageFrame].Picture = ""
    SysCmd acSysCmdClearStatus
  End If
  Exit Sub

End Sub

Each time I open the form to view I get a run-time error 2465 and a message "Microsoft Access can't find the field referred to in your expression" The Debug window shows the first line of code: 'If Not IsNull([ImagePath]) Then' highlighted. The ImagePath field in certainly in my sub form but for some reason Access isn't finding it. Can anyone help?
 
Last edited by a moderator:
I think, if you have the TextBox "ImagePath" on a subform, this should work...
Code:
If Not IsNull([Forms!YourMainForm!YourSubForm!ImagePath]) Then
    Forms!QPaperAdminForm!LargeImageForm![ImageFrame].Picture = Forms!YourMainForm!YourSubForm!ImagePath
    SysCmd acSysCmdSetStatus, "Image: '" & Forms!YourMainForm!YourSubForm!ImagePath & "'."
  Else
    Forms!QPaperAdminForm!LargeImageForm![ImageFrame].Picture = ""
    SysCmd acSysCmdClearStatus
  End If
  Exit Sub

End Sub
HTH
 
Thanks for the swift reply. Can see where you are coming from. Tried your sugggestion and got the same error!?
 
BillyMac said:
Thanks for the swift reply. Can see where you are coming from. Tried your sugggestion and got the same error!?
Can you post your db here? I'll take a look.
 
Hmmm, that would take me quite a while to work out! I'm getting errors left right and center. The attached example should be easy for you to work out how to use the code.

HTH
 

Attachments

Users who are viewing this thread

Back
Top Bottom