如题

解决方案 »

  1.   

    If Len(Dir(FarPath + "\dbf\ShootManege.mdb")) <= 0 Then '客户端 没有库
         If Len(Dir(App.Path + "\Database_Path.txt")) = 0 Then '要读取服务端的库
            MsgBox "Sorry!数据库无法开启,请检查主机是否打开或与系统管理员联系(Database_Path.txt文件不存在)"
            Call UnloadAllForms '存储网络版主机名的文本不存在
            Unload frmLogins
            Exit Sub
         Else
            Open App.Path + "\Database_Path.txt" For Input As #1
            Line Input #1, Comput_Name
            If Trim(Comput_Name) = "" Then
               MsgBox "Sorry!服务器端数据库名路径无法确定!请立即与系统管理员联系(ShootManege.txt文件没有内容)"
            Else
               Ss1 = Mid(App.Path, 1, 1) '找到服务器库路径
               Ss2 = Mid(App.Path, 3)
               Ss1 = CStr(Ss1) + CStr(Ss2)
               FarPath = Comput_Name + Ss1
               YL_DB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FarPath + "\dbf\ShootManeg.MDB" + ";Persist Security Info=False;Jet OLEDB:Database Password=***"
               YL_WFDB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FarPath + "\dbf\vindecate.MDB" + ";Persist Security Info=False;Jet OLEDB:Database Password=***"
            End If
         End If
     Else
        FarPath = App.Path '服务器版 本地库
        YL_DB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FarPath + "\dbf\ShootManege.MDB" + ";Persist Security Info=False;Jet OLEDB:Database Password=*********"
        YL_WFDB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FarPath + "\dbf\vindecate.MDB" + ";Persist Security Info=False;Jet OLEDB:Database Password=*********"
     End If
      

  2.   

    copy的,不知道对你有没有用:
        网络路径就是UNC格式,即:\\计算机名\路径。但是需要注意的是使用FileSystemObject拷贝网络目录时有点怪,如果要拷贝网络上的一个共享目录,需要这么做: 
         Dim fs 
         Set fs = CreateObject("Scripting.FileSystemObject") 
         ' 把myFolder下的所有子目录拷贝到myNewFolder 
         fs.CopyFolder "\\myMachine\myFolder\*", "C:\myNewFolder" 
         
         ' 把myFolder中的所有文件拷贝到myNewFolder 
         fs.CopyFile "\\myMachine\myFolder\*", "C:\myNewFolder" 
        你不能直接使用CopyFolder,如 fs.CopyFolder "\\myMachine\myFolder", "C:\myNewFolder",这样会出错。 
    废话:你可以用以上方法往目标文件夹拷贝一个小文件,检查拷贝是不是成功来检测是否存在该目录