Harry
Aug 9th, 1999, 07:21 PM
Wondering if anyone out there ever suceed exporting a DBase database to a DBGrid. These are the stuff I did in my program. Set the connect property on the data control to DBase, set the databasename property to the path of the folder containing the dbf table, set the recordsource property to the name of the table with the dbf extension, and bound the grid to the data control. However, when I tried to export the table to the grid using the code below I got the following errors: "Run-time error 3343. Unrecognized database
format. C:\dry.dbf"
I not sure what might have caused this error. I do know it is a DBase format. Can you look at my code and see if it is correct. If there is a better way to do this please let me know. Thanks a lot!!
P.S. Please, provide some sample code.
Dim dbsTemp As Database
Dim rstTemp As Recordset
Dim QueryString As String
Set dbsTemp = OpenDatabase("C:\dry.dbf")
Set rstTemp = dbsTemp.OpenRecordset("dry", dbOpenDynaset)
QueryString = "SELECT * FROM Kraftdry"
With rstTemp
Form2.Data1.Refresh
Form2.Data1.RecordSource = QueryString
Form2.DBGrid1.ClearFields
Form2.DBGrid1.ReBind
End With
------------------
format. C:\dry.dbf"
I not sure what might have caused this error. I do know it is a DBase format. Can you look at my code and see if it is correct. If there is a better way to do this please let me know. Thanks a lot!!
P.S. Please, provide some sample code.
Dim dbsTemp As Database
Dim rstTemp As Recordset
Dim QueryString As String
Set dbsTemp = OpenDatabase("C:\dry.dbf")
Set rstTemp = dbsTemp.OpenRecordset("dry", dbOpenDynaset)
QueryString = "SELECT * FROM Kraftdry"
With rstTemp
Form2.Data1.Refresh
Form2.Data1.RecordSource = QueryString
Form2.DBGrid1.ClearFields
Form2.DBGrid1.ReBind
End With
------------------