Attachment in Access 07

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
'm trying to add Attachment fiels in form which when click i want it to be transfered to the table in other database....
Does vba/query transfer the attachement to the table field?
Is this possible?


Thanks in advance for helping....
 
Thanks again for getting back...the code is from the code along with hte thread.
The code actually works...but now my question is why does it not go to the second/third row of the field...

it keeps adding attachment to same one field...


Please advice...
Thanks again...
hmm, where did that code come from ...

I *think* however, that the an attachment is stored in a system table that Access keeps track of ... so the child recordset must be the records in the table that *actually* stores the pictures .... which you get to through the field.

Just a guess on my part though.

 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
What does child recordset mean?
and FileData, Pictures mean?

http://msdn.microsoft.com/en-us/library/bb257442(v=office.12).aspx

Code:
[FONT=Courier New] '  Instantiate the parent recordset. [/FONT]
[FONT=Courier New]  Set rsEmployees = db.OpenRecordset("Employees")[/FONT]
 
[FONT=Courier New]  … Code to move to desired employee[/FONT]
 
[FONT=Courier New]  ' Activate edit mode.[/FONT]
[FONT=Courier New]  rsEmployees.Edit[/FONT]
 
[FONT=Courier New]  ' Instantiate the child recordset.[/FONT]
[FONT=Courier New]  Set rsPictures = rsEmployees.Fields("Pictures").Value [/FONT]
 
[FONT=Courier New]  ' Add a new attachment.[/FONT]
[FONT=Courier New]  rsPictures.AddNew[/FONT]
[FONT=Courier New]  rsPictures.Fields("FileData").LoadFromFile "EmpPhoto39392.jpg"[/FONT]
[FONT=Courier New]  rsPictures.Update[/FONT]
 
[FONT=Courier New]  ' Update the parent record[/FONT]
[FONT=Courier New]  rsEmployees.Update[/FONT]


The attachment data type is a multiple value list. This means it can store multiple attachments in the same field. You can access them using a recordset.


I have actually avoided the attachment data types do to all the issues it has.

I prefer not to store the fields in the database for several reasons.. I created an example of the method I use. See: Document Links 2
 
Upvote 0
Hi again Boyd, thanks for helping me accross different threads of mine...:)

'm going through that downloaded file...
the attachment thing is very very complicated...

Why cant i just move it any other datas...
is there a way to select all and get them to other databse table all together including the attached files?:)

Sorry but just need this...

Thanks again, Pedie:(
 
Upvote 0
No, i have not tried that [i dont know that]...please show how to do it...

Thanks again, Boyd:)
 
Upvote 0
Are you gping to import or export the table?

Importing it is no good, as if data is deleted in linked table, the data will be deleted in main database too...and i would not risk that.
I want to transfer the multi-value field/attachmnt to main database from front end.


Thanks again.
 
Upvote 0
Keep it simple for your first version. Just link the tables. Possibly you can just set the form the users are using so that deletes are not allowed. Keep regular backups so you don't have to worry about lost data. Users will usually go with the flow of a well designed form, so if there's no delete buttons around they won't try to delete anything - if they bypass these measures, then there is probably something they *need* to do that you haven't provided the right tools to get done. I try to be optimistic about users - mostly, if something works they are happy and use it as intended, and if it doesn't that's when they start messing around looking for workarounds. Unless it's me and I'm trying to reverse engineer your database, but that's another story. Or it's mission critical data (but then we really need to invest a *lot* of time in designing and testing everything).
 
Upvote 0
I want to transfer the multi-value field/attachmnt to main database from front end.

Why would are you first saving it to the front end then transferring it to the back end? This is not a normal method with Access. The Best Practice method is to avoid moving data whenever possible.


Why are you not saving it directly to the back end?
 
Upvote 0
Hi again everyone....


Thanks again:). Yes, 'll keep it simple there is site which address this at the moment....there is but not to this scenario. I am now using the loadfromfile..temporary

Code:
[/FONT]
[FONT=Courier New]Why are you not saving it directly to the back end?[/FONT]
[FONT=Courier New]
Because i do not know how to transfer it directly to backEnd:biggrin:

Thanks again.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top