Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dbase IV with relations

Status
Not open for further replies.

SBTBILL

Programmer
Joined
May 1, 2000
Messages
515
Location
US
I have 2 dbase IV tables I need to open. One is an invoice header table and the other is a line item detail table. As I need to be able to use a grid to move through the records in the header table and have another grid show the detail records for eash invoice each time the header changes.

I've not had much luck with getting them both open let alone setting a good relationship. A common key exists but the name and location of the tables will change frequently.

Bill Couture
 

SBTBILL,

I assume from your name that you have worked with the SBT accounting package. Isn't it fun!!!!

Ok, now to help answer your question. I am taking a guess that you are using copies of these tables from SBT that have been copied from the database location to another location (If not this should still work.).

The easiest way that I have accessed these types of tables in the past is to create an ODBC DSN using the Microsoft Visual Fox Pro drivers (that replace the MS dBase drivers). When creating the data source I checked the use free table directory. When you create this type of DSN you will be prompted for the default directory path, you can put in whatever you want and at runtime you can change this.

Then I used DAO ODBC Direct to access the tables, and if the tables were in different directories I would specify the full path to each table using an inner join statement.

I hope this helps, Good Luck

 
Yes I've been doing SBT for years. Am still a dealer. However, recently added Cougar Mountain which is written in DBase IV. Thus I can not use VFP to open the tables (it converts memo fields) and have to go back to VB.

Haven't really done much with VB since editon 4.0. That seemed to have much simpler table opening. The DBase IV stuff appears to be in a DBC just as PRO6.5 SBT (now ACCPAC source) is so I am opening a database with tables. I've tried doing ADO and ODBC in fox but it still wants to convert the memo fields.

Have the 4 Visual Basic 6.0 books (Compontents, Programmers Guide etc.) from MS. Also VB6 database programming for Dummies and Database Access for VB 6 and a couple others. Can't seem to find the right page.

Bill Coutue
 

Ok, the ODBC DSN that I create is the Microsoft Visual FoxPro Driver 6.01... (there are other numbers but as long as you have 6.+) or you may want to try the Microsoft dBase Driver (*.dbf) 4.00... which gives you a choice of which dBase you are connecting to (3, 4, 5 (if I remember correctly)). Remember free table directory...

The add a reference to your project, either...
Microsoft DAO 2.5/3.51 Compatibility Library or
Microsoft DAO 3.51 Object Library

Declare your Workspace and highlight the CreateWorkSpace statement and press F1. Look on that help page that comes up for ODBCDirect...
[tt]
Set daoWs = DBEngine.CreateWorkspace("0", "", "", dbUseODBC)
Set daoDb = daoWs.OpenDatabase("somename", dbDriverNoPrompt/dbDriverPrompt/dbDriverComplete/dbDriverCompleteRequired, True/False, "ODBC;UID=;PWD=;DSN=" & DSNName & ";Source=" & PathToDb)
'SELECT Whatever from " & PathToDb
[/tt]

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top