Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011

    Unanswered: finding the Temp Directory

    Hello,

    There's a lot of buzz about using Temporary Tables and Temporary Databases.

    I can create and manage them (many thanks to Tony of Granite Consulting). I want to place them in the Windows Temp directory, though.

    Does anybody know how to derive the path to the Windows Temp directory (since it's different from workstation to workstation)?

    Thanks!

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Try this API Function:

    Place the following into the declarations section of a database code module:
    Code:
    Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" _
    (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
    
    Public Function SetTempFolder() As String
        Dim strTemp As String
        strTemp = String(100, Chr$(0))
        'Get the temporary path
        GetTempPath 100, strTemp
        'strip the rest of the buffer
        strTemp = Left$(strTemp, InStr(strTemp, Chr$(0)) - 1)
        SetTempFolder = strTemp
    End Sub
    USAGE:

    MsgBox SetTempFolder

    OR

    Dim TempFolder As String
    TempFolder = SetTempFolder



Posting Permissions

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