473,387 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

VBA code to upload a document to a FORM prior to saving

I have a form which we use for data entry and sometimes we need to upload a document to keep with a record.

I have made a section for attachments in the table for storing these. What I'm after is some VBA code so when I click a button on the form I am using with the data entry, I can select a file to attach to this record. The catch here is that the record may not have been saved yet so i really need it to sit on the form until we are finished data entry then save this all as one record.

I wouldn't know where to start with this so have also looked at possibly storing the file path in a text box then once we submit the form some sort of code to attach the file (recorded in that file fath) to the attachment in the table.

Any help would be greatly appreciated. I have searched many threads and forums but nothing straight forward.
Oct 24 '14 #1
3 951
Seth Schrock
2,965 Expert 2GB
Depending on what version of Access you are using, you may or may not have the option to add a field to your table with a hyperlink datatype. If you do have this option, then you would have the ability to do a drag-n-drop with the file onto the textbox that is bound to this field. Are you wanting to be able to open the attachment from within the database? What type of files are these attachments? PDFs, Word docs, etc?
Oct 24 '14 #2
Thanks for the reply - I was worried no one would have a fix.

I am running Access 2010.

Yes I'd like to be able to open the attachments from within the database when required.

The file attachements are Word Docs.

Happy to give anything a shot, just haven't done the attachment thing before but want it to be user friendly so need to be able to enter the attachment from the form.

I dont want users accessing the back end of the database.
Oct 24 '14 #3
zmbd
5,501 Expert Mod 4TB
I strongly advise against storing the document within the database.
I understand that this is an option; however, it leads to bloat and the field is not universally supported should you need to upgrade. Worse, if the database corrupts, you lose all of your documents!
Instead, use the method that Seth is proposing where the link to the document's location on the pc/network is stored in the table.
Oct 24 '14 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Frank | last post by:
Does anyone knows why this string is nog working ? name = "sub" a textfield in a form function item(name,total, price) { window.document.form.name"".value = total; } thank you !
0
by: kalyan | last post by:
Hi Using Input in HTML i am allowing user upload the document. When they click submit i am saving in Server. They can upload same document any time. Here is my problem each time when they...
8
by: Ed Jay | last post by:
Is there a way to use 'document.form.submit()' to submit a form to a url other than that specified in the Form element? -- Ed Jay (remove M to respond by email)
2
by: alan_atwood | last post by:
Hello all. I am having a problem with the submit() method that is driving me nuts. I'm using document.form.submit() with large text fields (approx. 2000 characters) and am getting a "Invalid...
2
by: Colin Halliday | last post by:
I have a Word 2003 mail merge main document (form letter) that is linked to another Word document data source for the mail merge. If I open this doc using the Word GUI, it first asks me to...
1
by: user | last post by:
Hello ! i just you like to know if it's possible to print an upload document with asp.net ? People will upload a document that will be directly print on a printer connected to the asp.net...
4
by: Don Lancaster | last post by:
This program http://www.tinaja.com/demo28b.asp seems to work perfectly (for where it is at in the development and debug process) when run inside GoLive. Moving it online and viewing it with...
3
by: praveenm237 | last post by:
Hi, Can any tell me what is the purpose of document.form.taget= "Framename"; i know that output will be generated in that form.My doubt is document.form.target is mandatory or...
1
by: lorax | last post by:
I am new to this. I am recreating a form from ACCESS 2000 in Access 2010. The problem is that ACCESS no longer allow one to close a form without saving it. Form: a search form that allows people...
0
NeoPa
by: NeoPa | last post by:
Introduction : This article relates to the long-standing (Since at least Access 2.0.) problem whereby a Form, used within a Subform of another (main) Form, will have any temporary and transient...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.