|
-
Apr 22nd, 2001, 09:01 PM
#1
Thread Starter
Member
is there anyway where i can make it find the database file without c:\and path iw ant to be able to have the word
data.mdb
instead of having to do
c:\desktop\data.mdb
THANKS
-
Apr 22nd, 2001, 09:08 PM
#2
well, I don't think so, but if flexibility is what you are looking for, you can put the DB in the same folder as your app, and do this...
Code:
App.Path & "\data.mdb"
hope that helps
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Apr 22nd, 2001, 09:10 PM
#3
Frenzied Member
Or you can create a INI file that has the path to the database
-
Apr 22nd, 2001, 09:12 PM
#4
Registered User
You can scan a directory tree with:
Code:
Private Declare Function SearchTreeForFile Lib "imagehlp" (ByVal RootPath As String, ByVal InputPathName As String, ByVal OutputPathBuffer As String) As Long
Private Const MAX_PATH = 260
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim tempStr As String, Ret As Long
'create a buffer String
tempStr = String(MAX_PATH, 0)
'returns 1 when successfull, 0 when failed
Ret = SearchTreeForFile("c:\", "winword.exe", tempStr)
If Ret <> 0 Then
MsgBox "Located file at " + Left$(tempStr, InStr(1, tempStr, Chr$(0)) - 1)
Else
MsgBox "File Not found!"
End If
End Sub
-
Apr 22nd, 2001, 09:13 PM
#5
Registered User
To get all harddrives to scan:
Code:
Option Explicit
Private Declare Function GetLogicalDriveStrings _
Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal _
nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Declare Function GetDriveType Lib "kernel32" _
Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Const DRIVE_REMOVABLE = 2
Private Const DRIVE_FIXED = 3
Private Const DRIVE_REMOTE = 4
Private Const DRIVE_CDROM = 5
Private Const DRIVE_RAMDISK = 6
Private Sub Command1_Click()
Dim tmp As Integer
Dim tmpStr As String
Dim Drives As String
Dim HardDrivesCount As Integer
Dim HardDriveLetters As String
Dim ret&
'init Drives To 255 spaces
Drives = Space(255)
'get drives, Drives var will look like
'A:\, C:\, D:\, E:\, ..:\
'ret& is the New length of Drives
ret = GetLogicalDriveStrings(Len(Drives), Drives)
For tmp = 1 To ret& Step 4
'get a drive root directory (like "C:\")
tmpStr = Mid(Drives, tmp, 3)
'if drive is a CD
If GetDriveType(tmpStr) = DRIVE_FIXED Then
HardDrivesCount = HardDrivesCount + 1
HardDriveLetters = HardDriveLetters & Left(tmpStr, 1) & " "
End If
Next tmp
'display results
If HardDrivesCount Then
MsgBox "Number of Hard Drives Available: " & HardDrivesCount & " - Hard Drive Letters: " & UCase(HardDriveLetters)
Else
MsgBox "No Hard Drives Available"
End If
End Sub
-
Apr 22nd, 2001, 09:14 PM
#6
Thread Starter
Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|