Results 1 to 6 of 6

Thread: path of database

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2001
    Posts
    41

    Cool

    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

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    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

  3. #3
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Brooklyn NY USA
    Posts
    1,258
    Or you can create a INI file that has the path to the database

  4. #4
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    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

  5. #5
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    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

  6. #6

    Thread Starter
    Member
    Join Date
    Apr 2001
    Posts
    41
    alright thanks alot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width