Topics Search

How do I save "Attachment" objects automatically?

How do I save "Attachment" objects automatically?
Views: 114
I have a need to output a list of about 22000 entries, each one with a JPG attachment, into a directory (i.e. save every attachment of every entry back into a file)

However, there doesn't seem to be any immediate ways to do this other than clicking on each entry, then clicking on its attachment, and then clicking "save as".

It would seem sensible that there must be an code specific way to do it, seeing as that functionality is already coded in the attachment "Save As" button. Is there anyway to invoke that function automatically
Sponsored Links:

More topics

 

How do you file save an 'Attachment' content through code?

Preview
I have a need to output a list of about 22000 entries, each one with a JPG attachment, into a directory (i.e. save every attachment of every entry back into a file)

However, there doesn't seem to be any immediate ways to do this other than clicking on each entry, then clicking on its attachment, and then clicking "save as".

It would seem sensible that there must be an code specific way to do it, seeing as that functionality is already coded in the attachment "Save As" button. Is there anyway to invoke that function automatically
 

Remove specific type of attachment from all records in table

Preview
I have table call "empTable" and it has an Attachment field called "Attachment". Some of the records has empty Attachment field and some record has one attachment and some has two and the attachment types are jpeg and pdf.

I want to remove all the pdf from all the records in this table automatically with VBA or something,
 

Save Report in Attachment

Preview
I have a Exam DB where we genreate the Question papers as rtf ( M S WORD File). We have to attach the above file manually to our attachment field
Table:Exam_Papers
Attachment Field:Privious_Papers
Can this be done through code automatically?
 

IsNull not catching all nulls

Preview
I have a field in Event table called EventAttachment. EventAttachment is an Attachment datatype. I want the code to see if it is null and if so put No Attachment in the caption. Sometimes it works and sometimes it doesnt. For instance, Record 455 has no attachments but it displaying Attachment.

Below is the code:


If IsNull(DLookup("EventAttachment", "Event", "CompanyID = " & Me!txtCompanyID)) Then
Me!cmdAttachments.Caption = "No Attachment"
Me!cmdAttachments.ForeColor = vbRed
Else
Me!cmdAttachments.Caption = "Attachment"
Me!cmdAttachments.ForeColor = -2147483615
End If

Does anyone see anything wrong with the
 

Color in VBA

Preview
I have a button called cmdImage. Caption = "Attachment" and ForeColor = TextDark.

I want it to display "No Attachment" in red when empty, and "Attachment" in TextDark when it's not. That way, I will not have to click on the button to see if there are any attachments.

I created the following code:

If IsNull(DLookup("EventAttachment", "Event", "CompanyID = " & Me.txtCompanyID)) Then
Me.cmdImage.Caption = "No Attachment"
Me.cmdImage.ForeColor = vbRed
Else
Me.cmdImage.Caption = "Attachment"
Me.cmdImage.ForeColor = vbBlue
End If

The problem is: vbBlue is not the TextDark blue I was using.

How do I get it to leave the default values or to put the correct color blue back?

Or, should the above code be written differently
 

SendObject with dynamic attachment name

Preview
- I am attempting to send a PDF of a report via email and the SendObject function but I don't know how to create the attachment with a dynamic name. What happens is the name of thereport gets passed to the name of the attachment.

DoCmd.SendObject acSendReport, "rpt_Certificate", acFormatPDF, "replace.me@domain.com", , , Subject, Body, Yes, ""

Something similar to this:
 

Saving an image on the clipboard to the attachment type in Access 2010

Preview
Two weeks ago I started to use Access for the first time and yesterday looked at VB. Mind you, I have extensive experience in Pascal, assembler, some C and QBasic/GWBasic in the DOS days.

I'm using Access 2010 and the attachment type in a table. I can generate a form and load an image from a file into this table.
What I would like to do is save the image captured onto the clipboard into the attachment field of the table.
Ie ALT+Printscreen then press a button on the Access form that puts this into the attachment field. Pressing Cntl+V on the attachment doesn't work

I imagine the VB code for the button press would probably be a two part process -
1. Get the image from the clipboard and save as a file ie JPG.
2. Load the JPG file into the attachment field.

I have the below code but it references a excel variable "xlBitmap" and won't compile in Access VB?
 

Add a new record with attachment using VBA

Preview
At the submit button, I need the values to be updated to the table.

Here is the code for the "add record" that I created. I added this line MySet!trAttach = Attachment
in the code for Attachment and get an error "type mismatch".
 

Add multiple records with one field

Preview
Please find attached my form, the "Slide" field is of type attachment. This field usually has min 5 attachments, is there a way that a record can be made for each attachment added, the Start and End Date will be the same for every attachment.

Can someone please help, it takes a long time to add each attachment seperately.
 

Add an attachment to form

Preview
I am trying to add an attachment to a subform. I update the control source to say "Attachment" in the properties section which matches the name of the field in the table where it's pulling from.

When I open in form view and right-click on the text box (for attachment) the manage attachments selection is greyed out. If I go to the table I can open the attachment.

Any idea why this isnt working in the form