PDA

Click to See Complete Forum and Search --> : ? DBGrid with foxpro2.6 in column1, text file in column2


StillAwake
Jun 18th, 2000, 06:54 AM
I have 1 Data control, and want to use 1 DBGrid, with 2 columns. Column 1 is from a fpw26 dbf (read only), and column 2 is a text file (read/write). Both have the same number of rows/lines. I'm using win 95, fpw26, and VB5 pro

I know how to use one Data, DBGrid, and foxpro 2.6 dbf file using the Properties Window, but I'm having trouble setting it up using only code. Either I get "file does not exists" or "class doesn't support Automation"

This is what I have so far, which isn't much.

Dim FoxFreeDB As Database
Dim FoxFreeRS As Recordset
Set FoxFreeDB = OpenDatabase("D:\cdset\testit", False, False, "FoxPro 2.6;") ' change to True,True once it works
Set FoxFreeRS = FoxFreeDB.OpenRecordset("cdprog.dbf")

any other code I add like "Data1.RecordSource =" or "DBGrid1.DataSource =" gives errors. I made sure all dlls and DBengines where up to date and registered. but I can't get the grid to display the field I want, and my Select statement gives a "Complie error : Expected: Case"

If I have to, I'll just use one dbf file, but can I make one column read only, and the other read/write ?

StillAwake
Jun 19th, 2000, 08:28 AM
Doh

I didn't have any luck, so I decided to try and use 2 dbfs, I originally wanted 2 dbf files in different directories, one a read only (column 1)(on CDrom) and one with only one field (column 2) on the users system (preferred second file to be a text file).
but had to settle for making file 2 larger

I got this far...

Dim dbmain As String
Dim FoxDB As Database
Dim FoxRS As Recordset
dbmain = App.Path
Set FoxDB = OpenDatabase(dbmain, False, False, "FoxPro 2.6;")

Set FoxRS = FoxDB.OpenRecordset("Select dbfile1.field1,dbfile2.field2 From dbfile1,dbfile2 Where dbfile2.idfield=dbfile2.idfield;")

Set Data1.Recordset = FoxRS

I'm testing it with both files in a temp dir along with the App, but now when I try to edit coulumn 2 I get error 3027
I believe it's Connection problem, so I modified my code to

Set FoxDB = OpenDatabase(dbmain, False, False, "FoxPro 2.6;", dbOpenDynaset, dbSeeChanges, dbPessimistic)

Set FoxRS = FoxDB.OpenRecordset("Select dbfile1.field1,dbfile2.field2 From dbfile1,dbfile2 Where dbfile2.idfield=dbfile2.idfield;", dbOpenDynaset, dbSeeChanges, dbOptimistic)

no matter what I do
Debug.Print Data1.Recordset.Updatable
always prints False

I'm confused.. I thought I was using the
Microsoft Jet database file divers, but every thing I read makes it sound like it's using ODBC

Any Ideas ???
Thanks