Attachment icon on main form

Danick

Registered User.
Local time
Today, 07:52
Joined
Sep 23, 2008
Messages
371
From the main continuous form, users can double click a record that will open a single form for that record. This single form also has a subform with fields that allow users to click a button to add a file path link to an attachment. There is also another button to be able to open that attachment.

I would like to add a field on the main form that will show an attachment icon (like a paper clip) if any of these fields in the single forms’s subform are not empty.

Anyone have any idea on how to do that?

Thanks
 
What kind of data do some of the fields hold? Have you got a bmp image of a clip?
 
What kind of data do some of the fields hold? Have you got a bmp image of a clip?

The data is in a text box. And they hold file paths like "c:\foldername\filename.pdf". Basically I need to find a way to test if the text box in the subform is not empty and then show that in some way on the main form. I thought of an icon like a paper clip. But it could also be just an unbound text box in the main form that becomes a big "X" when the subform field has data in it.

Thanks
 
You can just use the Nz() function:
Code:
=Nz([PathField], "C\Image\To\Clip.bmp")
 
You can just use the Nz() function:
Code:
=Nz([PathField], "C\Image\To\Clip.bmp")

Thanks

I'm having trouble figuring out where to put this code.

Also, maybe instead of getting an image outside of the program, is it possible to have a clip icon hidden on the main form and then make it visible when the PathField is not empty?
 
So I pasted a small picture of a paperclip on my form and called it ClipPic.
Then on the On Current event of my single form, I have this code:

Private Sub Form_Current()
If Nz(Me!LinkToFile, "") = "" Then
Me!ClipPic.Visible = False
Else
Me!ClipPic.Visible = True
End If
End Sub

This works fine when viewing the single record.
But it does not work with the main form which is a continuous form.
The on current event places the image or takes away the image on every record depending on the LinkToFile field of the current record selected.

Is there any way to do this on a continuous form?
Basically, I'm trying to do something like on this forum where the little paper clip appears on the right side of a post that has attachments.

Thanks
 
It's supposed to be in the Control Source of your Image control as per my first post. What version of Accecss are you using?
 
It's supposed to be in the Control Source of your Image control as per my first post. What version of Accecss are you using?

The paper clip icon is a bitmap embedded image in the form.
It has no Control Source. In fact there isn't anything under the Data tab for this image at all.

I'm using Access 2003

Ideally, I'd like to also show the number of attachments as well.
The main form record is linked to a subform. But the LinkTo field in the subform does not have to be filled for every record in the subform.

For instance, the record in the main form shows 3 associated records in the subform. But of those 3 records, only 2 of them have attachments.

So I'd like to have the main form show a paperclip icon next to each record where the its associated records in the subform have the LinkTo field filled in and somehow also display how many attachments there are.

Is this maybe asking too much?
 
Last edited:
An Image Control, not an Object Frame. If you had a Single Form then your method of flipping the Visible property will work, but when it comes to a Continuous Form you will have to use an Image Control and change it's Control Source to the full path of the appropriate image you wish to display.

Have a read:

http://office.microsoft.com/en-us/a...s-forms-reports-and-controls-HA001147204.aspx

Well after reading this very detailed description, I still can not get this to work. So I've just about given up and went with a simple DCount from from the main form that counts the links on the subform. I put this code in a small textbox on my main form

=DCount("[LinkToFile]","tblName","[IDField1]= " & ([IDField1))

It doesn't show my little paper clip, but at least it's showing how many attachments there are (which is what I really need anyway). Now I just gotta figure out how to suppress all those zeros...

Thanks for all your help.
 
Attach your db, attach a paper clip image and I'll show you.
 
Attach your db, attach a paper clip image and I'll show you.

I think I'm just going to use the Dcount. It's probably not very efficient, but it seems to be doing what I need.
I just put an small icon in the header of the continuous form and then use the dcount to show how many attachments there are in the linked field of the subform.

And after some searching on this forum, I found this little code that even removes all those nasty zeros for records with no attachments.

=IIF(<fieldName> > 0, <fieldName>, NULL)

But thanks for your help and offer to get my original request working.
 

Users who are viewing this thread

Back
Top Bottom