473,396 Members | 1,770 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,396 software developers and data experts.

Using Drive Names rather than Letters

Hi People! I use this site loads but this is my first post - so hope you can help!

I've got an access database and I'm writing some code to move contents of USB memory sticks to certain locations on the network depending on the owner of the stick and date and things like that.

The problem is how I get this to work on everybody's PC. The stick do not always have the same drive letter, but they do have the same name (KINGSTON in our case).

How do I use drive names rather than letters in my code? Even better, could I just write something that would detect where a USB memory stick is? I've mananged to identify removable disks, but that's no good because of floppys and card readers etc.

Thanks for reading - Chris
Jul 12 '07 #1
2 1510
Killer42
8,435 Expert 8TB
One fairly simple mthod would be to use the File System Object model to scan the drives for the one with the right volume name, then use the letter of that drive. See the VB doco for FileSystemObject.
Jul 13 '07 #2
Sorted! Thought I'd post what I found:

Sub USBLetter()

Dim oFSO, oDrive, objFolder, oDestination, oUsbdrive
Const USBDRIVE = 1
Set oFSO = CreateObject("Scripting.FileSystemObject")
'Get USB drive letter
For Each oDrive In oFSO.Drives
If oDrive.Drivetype = USBDRIVE And oDrive.DriveLetter <> "A" Then
oUsbdrive = oDrive.DriveLetter & ":\" 'so oUsbdrive is the memorystick path
End If
Next


End Sub

Simple? Not to me! I'm on a steep learning curve.....
Jul 13 '07 #3

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

Similar topics

4
by: mh | last post by:
Hi Folks- I'm trying to do a simple emulation of unix "locate" functionality in python for windows. Problem is I don't want to crawl/index optical drives. Do any of the windows people out...
17
by: HALLES | last post by:
HELLO ! I seek to use a form too fill a file without putting a server on my computer. I am no C# programmer, i can do some things in Javascript but IT CAN T WRITE REWRITE APPEND A FILE ON LOCAL...
3
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
1
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the...
34
by: kevin.watters | last post by:
Hi all, I have a need for a short program: Given a drive letter, it would recursively search through all directories, "generating" each filename that it encounters (need to pass each filename...
6
by: Steve Gerhart | last post by:
Hopefully someone can point me in the right direction. I'm try to construct a table that has the following information about disk drives on 2000 and NT 4.0 boxes. Size, Partitions and Logical...
61
by: Christoph Zwerschke | last post by:
On the page http://wiki.python.org/moin/Python3%2e0Suggestions I noticed an interesting suggestion: "These operators ≤ ≥ ≠ should be added to the language having the following meaning: ...
4
by: Jim Carlock | last post by:
function CreateMyDataBaseFile($FQFN, $UID, $PW) { $db = "sqlite:" . $FQFN; $sql = "CREATE TABLE Customers(name1 TEXT, name2 TEXT);"; $dbh = new PDO($db, $UID, $PW); $dbh->exec($sql); $dbh =...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.