• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 142
  • Last Modified:

checks to see if program exists if not then copies it but having trouble with name type being slightly different

I have the following code that when a database .mdb file is being pulled up it checks to see if the name and path is already listed in tblAdjustDBs.  The trouble is that sometimes the db1.Name does not give you the full path and does a type of shorthand on the path and I end up getting duplicate entries for one database.
One example is the following:
I:\proj\mem-herm\Woodlands\EC12001-00\MedEquip\WoodlandsACC-Procurement.mdb
I:\proj\mem-herm\WOODLA~1\EC1200~1\MedEquip\WoodlandsACC-Procurement.mdb

Both are the same database but because one has the ~ sign it added it twice.
Any info on how I can avoid the above from happening?


Dim db1 As DAO.Database
    Set db1 = CurrentDb()
    sSelect = "SELECT * FROM [tblAdjustDBs] WHERE [DB] = '" & db1.Name & "'"
    rstData.Open sSelect, cnnData, 2, 3
        If rstData.EOF Then
            SysCmd acSysCmdSetStatus, "Adding " & db1.Name & " to list of adjusted DBs..."
            sSelect = "INSERT INTO [tblAdjustDBs] (DB, Adjust) VALUES ('" & db1.Name & "', True)"
            cnnData.Execute sSelect
        End If
    rstData.Close
0
stephenlecomptejr
Asked:
stephenlecomptejr
  • 3
1 Solution
 
GrahamSkanCommented:
You  could convert to the Long path name using the GetLongPathName API
0
 
GrahamSkanCommented:
There's an example here
0
 
stephenlecomptejrAuthor Commented:
thanks Graham
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now