还有一段代码:
  Dim MyRS1 As Recordset
  Set MyDB = OpenDatabase(gsDatabase, False, False, gsConnect)  接下来我怎么通过MyDB获得里面有多少个dbf表并写入Combo里面。

解决方案 »

  1.   

    http://jinesc.6600.org/myweb/disp.asp?idd=91&room=40
      

  2.   

    哦。  没看清楚贴,  直接就用DIR()就可以了
      

  3.   

    '将指定目录下所有DBF文件添加到COMBO中的过程
    Sub AddDbfFile(Path As String)
    Dim tPath As String, tFile As String
    tPath = IIf(Right(Path, 1) = "\", Path, Path & "\")tFile = Dir(tPath & "*.dbf")
    If tFile <> "" Then
    Combo1.AddItem tFile
        Do
        tFile = Dir()
           If tFile <> "" Then
           Combo1.AddItem tFile
           End If
        Loop Until tFile = ""
    End If
      

  4.   

    方法二:
    Dim Db As Database, Tbs As TableDefs
    Dim i As IntegerSet Db = DBEngine.OpenDatabase(CurDir, False, False, "FoxPro 2.5;")
    Set Tbs = Db.TableDefsIf Tbs.Count > 0 Then
       For i = 0 To Tbs.Count - 1
       Combo1.AddItem Tbs(i).Name
       Next
    End If