473,856 Members | 2,128 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create a drag and drop field for files?

Seth Schrock
2,965 Recognized Expert Specialist
I'm trying to create an easy way to get references to files into my database. I want users to be able to drag and drop a file from their desktop (or anywhere else on their computer) onto a control of some kind and have the file get placed on the server with a hyperlink in the database to the file on the server. In reading stuff online, I found out that the Hyperlink data type makes it so that you can drag a file onto a textbox and it will automatically create a hyperlink to that file. My idea was then to use that hyperlink to be able to do a FileCopy to the server and then change the value in the control to be the location on the server instead of the user's PC. When tried, the hyperlink that gets added to the text box when the file is dropped onto it is not a regular file path that FileCopy can use. It starts with ... and then the file path inside pound signs and then duplicates that again. Also, it doesn't include the starting part of the file path so I can't use Left(), Right(), or Mid() functions to parse it down to a usable file path. Now I'm out of ideas.
Mar 16 '13 #1
25 33672
zmbd
5,501 Recognized Expert Moderator Expert
Seth,
Search thru Bytes on hyperlink fields, Rabbit (I think) has helped a few others out with how these fields are formatted.

You should also take a look at: Introduction to Hyperlink fields
Mar 16 '13 #2
Seth Schrock
2,965 Recognized Expert Specialist
Well, I now know why it had all the parts to the value stored in the textbox. I'll have to see if I can parse out the link itself and use that, but I doubt that it will work once I start pulling it apart.

Is there another way to do drag and drop that would be easier?
Mar 16 '13 #3
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
There are usually quite many ways to do things in access.

I have not worked with hyperlink fields in Access, so if I end up saying something wrong, please excuse me.

A quick test revealed that in Ac2010 when I drag and drop a single file, I get a RELATIVE path inserted automatically in the field. That means alot of "../" to backstep directories with the files I tried. I presume you have the same issue, and that you would rather have the absolute path?
Mar 16 '13 #4
Seth Schrock
2,965 Recognized Expert Specialist
Assuming that I will use the FileCopy method to copy the original file to the server location, I would need the absolute path as the source. And yes, I'm getting the ... at the beginning of the path. From reading online, hyperlink fields are a pain to work with and it is easier to use plan text fields and just make them hyperlinks manually. I'm not against this, but I then loose the ability to drag and drop my files into the textbox and have it get the file path. Or is there some VBA code that can get the file path for me?
Mar 16 '13 #5
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
Personally I use the ListView Active X control which is bundled with the treeview in the Microsoft Common Control Library. The listview has a Drag-n-Drop event which can be coded to receive files, and do a filecopy.

However the listview will not work in 64 bit. So whether that is acceptable or not is up to you. The code can get a bit complicated since Drap-n-Drop of multiple files can be a bit messy :)
Mar 16 '13 #6
Seth Schrock
2,965 Recognized Expert Specialist
When you say multiple files, do you mean all at once or many files separately? Is that 64 bit computer or Office installation?
Mar 16 '13 #7
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
I mean selecting multiple files and dropping them all at once into your form. Not impossible to deal with, but does require a bit extra. Furthermore dragging a file from an outlook email for example is NOT the same as dragging a file from your desktop.

I don't mean this to discourage you, just to make sure you are aware of the path ahead.

The treeview (and listview) will work fine in Windows 32 AND/OR 64 bit, but will ONLY work with office 32bit, and thus NOT with office 64 bit.
Mar 16 '13 #8
Seth Schrock
2,965 Recognized Expert Specialist
I can just say that the users can only do one file at a time (maybe put some code in that blocks it if more than one file is attempted?). That is no big deal. I had already discovered that about the emails. Is it possible to drag from an email or do I just have to have them drag to the desktop (or anywhere else) and then drag it into the database?
Mar 16 '13 #9
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
I have a warning that says 1 file at a time if multiple files are uploaded.(Since my process involves alot of registration about the document) It gives a similar warning if a user tries to drag a folder.

I am sure its possible to get the attachments out of outlook, just haven't looked into it. I check for it, and give a warning.

I will return with some sample code tomorrow. Its a bit late here, and I want to do it proper with some details and explanation.
Mar 17 '13 #10

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

Similar topics

5
3023
by: simon_s_li | last post by:
Hi, I have 5 fields in line where I need to drag and drop the text from one field to another field and then all the fields need to re-order themselves. So for instance if I drag the text in field 1 to field 3, then field 2 text and field 3 move to field 1 and field 2. I add the new order of text into an array so when the onDragEnd event
2
4340
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard ( I don't mean different formats): SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put there? What about Drag/Drop; is there more than one way for the source to make data available Is it always OLE?
4
2216
by: Qingdong Z. | last post by:
I have a VS.NET windows application which use drag-drop feather. It works fine when application start, but stops working after application run one or two days. The application is related to Video process, CPU/Memory extensive. The drag-drop is in a new windows form. It drags from TreeView Control to other control in the same form. It cannot trigger ItemDrag event of TreeView after drag-drop feather die. Can you give me any idea? Thanks.
14
2188
by: Nathan | last post by:
I'm working for the first time with the DoDragDrop method. I've got almost everything worked out, but I need some help with the last bit. There are two listboxes on my form, lstGroups and lstStudents. I want to be able to drag a name from lstStudents and drop it on one of the names in lstGroups to move it to that group. I've got the dragging part working; it's just the dropping that isn't there yet. I'm working with what I can find...
0
1373
by: Robin Tucker | last post by:
I've implemented an IDataObject interface around one of my classes in order to facilitate drag/drop from my application into explorer. What I want to do is allow the user to select a series of data objects in my application and to drag/drop them onto explorer for explorer to create files of them. Is this possible, or will I just have to stick with an explicit "Export" method in my program?
5
10171
by: Brian Henry | last post by:
I haven't worked much with drag/drop but I am trying to make a form that accepts files to drug onto it from explorer and droped and have the form know the full path and file name of the files dropped onto it.. does anyone have any examples of this? thanks
0
1046
by: .Netter | last post by:
the user of my app should be able to drag an object (e.g. a file) out of my app into another folder or another app. everywhere i found information how to drag n drop objects(files) from one control to another control in the same application but nowhere i found a hint how to drag objects (files) out of an app and drop them into another one. is someone out there who know how to do that? thanks for your help.
1
1837
by: Nick | last post by:
Hi, I am developping an app using managed C++. I want to be able to do a drag drop from the app to windows explorer. The files to be dropped onto explorer do not exist yet, the files are to be created by the app when the user does the drop into explorer. I have done some searches and found COleDataSource::DelaySetData could be useful but this is MFC and I can't find the equivalent in .NET.
0
1412
by: Mukesh Agarwal | last post by:
Hi, I am developing a windows application, in which I am giving two options to the user for the file selection. 1. Open File Dialog 2. Drag/ Drop Now I want that the user can Drag/Drop files from the browser which opens through Open File Dialog. This is not a default feature.
17
4723
by: radhikams | last post by:
Hi I want to create a drag drop tool box using javascript... Can anyone please guide me in this regard Thanks
0
9903
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9754
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11047
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10692
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7927
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5953
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4567
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4168
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.