VBA to simulate Acess 2007 Atachment doubleclick (1 Viewer)

Local time
Today, 15:02
Joined
Aug 3, 2005
Messages
66
[SOLVED] VBA to simulate Acess 2007 Atachment doubleclick

Hello.

I would like to add a cmdButton to add attachments to the attachment field instead of the user having to doubleclick the field itself.

Any ideas ?

Thanks.
Jamie.
 
Last edited:

pr2-eugin

Super Moderator
Local time
Today, 14:02
Joined
Nov 30, 2011
Messages
8,494
Jamie, are you seriously thinking of storing files in your DB?
 
Local time
Today, 15:02
Joined
Aug 3, 2005
Messages
66
Jamie, are you seriously thinking of storing files in your DB?

Hey pr2-eugin (btw: thanks for your help with a previous unrelated post).

Yes, the A2007 attachment control works well for me.
The database will contain at most 50 records.
The attachment field will hold one jpeg (id size pic of person), and maybe 3 pdf files.

So file-size is not an issue for me.

To double-click the attachment control on the form is not an issue. I was just looking for a more "elegant" way for the user to "Click this Button to add a file".

The cmdButton
Code:
 should then simply do exactly what the attachment control's double-click does.

I've been googling for 2 days now without luck. Maybe my search terms are wrong. (English is not my first language).

Thanks again.

[EDIT]

Sorry, i was just thinking of something like this:

With code like -

cmdMyButton_Click  'But (double-click instead of single-click)

Going to play with that now...
 
Last edited:

StarGrabber

Junior App. Developer
Local time
Today, 15:02
Joined
Oct 21, 2012
Messages
165
The "trick" is to use a second recordset, which contains the attachments.

With the built-in functionality you need 7 (in words: seven!) clicks to add a new attachment.

With some code (see attached file) you need only 3. :)
 

Attachments

  • AttMgr.zip
    29.3 KB · Views: 115
Local time
Today, 15:02
Joined
Aug 3, 2005
Messages
66
That is impressive!

Thank you StarGrabber. That is exactly what I had in mind.
And the added functionality of limiting the filetype is awesome.

Thanks again.
Regards.
Jamie.
 

StarGrabber

Junior App. Developer
Local time
Today, 15:02
Joined
Oct 21, 2012
Messages
165
Glad to help. However, reviewing the code once more, I found some LOC missing regarding the reset of "mBlnNewRecord".

Therefore I've attached the updated file. - Sorry for that.

StarGrabber
 

Attachments

  • AttMgr_upd.zip
    28.6 KB · Views: 121

Users who are viewing this thread

Top Bottom