UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Question about Working With Access Attachment Fields demo, Access 2010    
 
   
IanW
post Nov 22 2017, 09:09 AM
Post#1



Posts: 1
Joined: 22-November 17



Using Access 2010 and Win7 Professional

This demo from 2015 Looks like a more elegant option than I have at present.
However. when I tried to add an attachment I get error #3420 Invalid object
ErrExit:
rsA.Close
Go to the top of the page
 
DanielPineault
post Nov 22 2017, 09:55 AM
Post#2


UtterAccess VIP
Posts: 6,273
Joined: 30-June 11



Try adding On Error Resume Next per

CODE
...
ErrExit:
    On Error Resume Next
    rsA.Close
...



You could also review another demo, such as: http://www.devhut.net/2017/07/11/ms-access...ent-data-types/
Go to the top of the page
 
GroverParkGeorge
post Nov 22 2017, 09:57 AM
Post#3


UA Admin
Posts: 34,106
Joined: 20-June 02
From: Newcastle, WA


It looks like there is an error in the way the code cleans up after itself when it has attached a new file to an attachment field.

I would strongly suggest you think through whether bloating up an accdb with lots of internally stored files is really a good idea, but if you want to pursue it, add this line in the ErrExit section.

ErrExit:

On Error Resume Next
rsA.Close
rst.Close
dbs.Close

Set dbs = Nothing
Set rst = Nothing
Set rsA = Nothing

Exit Function
Go to the top of the page
 
GroverParkGeorge
post Nov 22 2017, 09:58 AM
Post#4


UA Admin
Posts: 34,106
Joined: 20-June 02
From: Newcastle, WA


And Daniel's link is a good idea to check out.
Go to the top of the page
 
GroverParkGeorge
post Nov 22 2017, 09:59 AM
Post#5


UA Admin
Posts: 34,106
Joined: 20-June 02
From: Newcastle, WA


I'm going to amend the demo as suggested....
Go to the top of the page
 
DanielPineault
post Nov 22 2017, 09:59 AM
Post#6


UtterAccess VIP
Posts: 6,273
Joined: 30-June 11



As George suggests, think long and hard about using attachment data types. Typically, they should be avoided! You may like to review http://www.devhut.net/2016/10/03/adding-at...ccess-database/ which offers a demo which clearly illustrates the traditional method of dealing with attachments.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    13th December 2018 - 08:42 PM