• 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:

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
  • 3
1 Solution
You  could convert to the Long path name using the GetLongPathName API
There's an example here
stephenlecomptejrAuthor Commented:
thanks Graham

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