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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing dbf into Access

Status
Not open for further replies.

brucomela

Programmer
Oct 15, 2001
52
0
0
IT
I'm a complete newbie in Fox Pro,and I'll try to be clear anyway..my problem is:I need to interact (through ASP) with a dbf file, that comes together with a cdx and an fpt. I'm used to working with MS Access, and I'm quite disoriented because I can't manage the unique ID in the dbf file. I suppose cdx is the index, but, how can I manage it?Can I import dbf and cdx together into an access DB or is there any other way out (please, be detailed and clear!!)?
Second question:memo file seems to be encoded in some way, is there a standard coding/encoding mode?How can I read memo fields?I guess they are stored into fpt file, but they don't appear in un understandable language!
 
Hmmm... this is a tricky one.

Assuming you are connecting to the MDB using a DSN connection. Are you connecting to DBF using a seperate connection? Or are you only connecting to the MDB and using links w/i it to connect to the DBF?

The later may be simpler to deal with since you are used to using access already.

Do you need write access to the DBF or just readonly? -Pete
 
At the moment I'm connecting to the dbf using a DSN connection. My problem is with the Unique ID, useful to index this db. I would do without importing into access just if I had an index!! Index in cdx infact is external to dbf (it's a different file!) and I don't know how to manage it in my ASP pages!

Keep on helping me please, I'm in a little mess with this!!
 
Setting up link in Access to DBF

This assumes the DBF is free table and not part of a DBC

1) In your MDB select File menu, Get External Data, Link Tables

2) Files of Type, Select ODBC databases and a new dialog box will appear.

3) Switch to Machine Data Source Tab

4)Select Visual FoxPro Tables and click OK

5) Type in the path or navigate to it with the browse button. Keep the Free Table Selection, then select OK.

6) A new dialog will list all the DBF tables in that directory. Select all the ones you want to import and click OK.

7) Next you will be prompted to select a unique key field. Foxpro does not require this, and very likely your table does not have one. So w/o making any selection click OK for each table.

8) Now your done. You can query the DBFs just like any other one.

yes CDX are compound index files and may contain many indexes.

yes FPT are memos, and they are translated perfectly by the procedure described above.


If you don't need to maintain the DBF you can import it using the same procedure, just choose import data instead of link in step 1. -Pete
 
You're almost at the point of this!! BUT, at point 6 your procedure doesn't work: error message: INVALID INDEX DEFINITION
Why do I get this message (I'm trying to import, not to link tables)?

Thank u Pete, you're on the right way!!
 
you could do two things,

1) rename the CDX file something else and it should be ignored.

2) open the table in VFP and use the REINDEX command

I think #1 will do it for you. I tried it here on a DBF with a indexes (CDX) and memos (FPT) it worked fine.

BTW once you have imported the data you can create a Auto Unique index field in Access. -Pete
 
i tried the exact same steps and i choose the dbf files then click ok...then it shows me another screen that prompts me to pick the tables...and the list is blank...what do i do here??
 
xkidd

You may want to start your own thread for this question, the post is avor a year and a half old.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top