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

excel to dbf 1

Status
Not open for further replies.

sqlpro

Programmer
Dec 30, 2003
297
NZ
hi friends

I have excel file with data in 1st col like following..
1
2
3
4
AA1
AA2
AA3
AA4
C2PI
and when i run following command in vfp 6
loExcel.ActiveWorkbook.Activesheet.SaveAs( ADDBS(lcPath) + "ACCCodeXLS",FORMAT_DBASE4)

it saving only 1,2,3 and 4 only and ignoring other values.
i even tried saving directly from excel also but samething happens.
i even chnaged column to text(i mean using formatcells)
any ideas please.
Thanks

cheers
 
Thanks for post Lee.
Yes,Yet the moment they'll be in that format.i am not sure what happens in future.
Thank you very much
rajani

cheers
 
sqlpro

Just ran a test with that data and saved the file as test2.xls on my desktop

Issued the same command as before:

Code:
IMPORT FROM C:\WINDOWS\DESKTOP\test2.xls TYPE XLS

The data is perfect in a table called test2.dbf

The field A which was created automatically by VisFox has actually been created as a date field for the imported data which it's recognised from Excel.

So I'm not sure what is happening with the last number dropping off when you try it, but it works perfect here.

Before you try it again, open up the excel file and try double clicking to the right side of the column where the date data is and this will make the widest data automatically fit in the column (Sorry if you knew this already)

If you try it again and it does work, you can use the similar code I mentioned earlier in the thread with a slight change:

Code:
use test2 excl
alter table test add column yourdatefld
go top
do while not eof()
  replace yourdatefld with A && Your (Date) data from Excel
  skip
enddo
alter table test drop column A
go top
brow
close databases
return

Hope this helps you my friend but in anycase post back with how you get on

Good luck
Lee

Alone we can do so little, together we can do so much
 
Thank you very much for keeping ur word Lee.
I think ur suggestion should work now.if i encounter any problems i'll let u know.
Thank you very much once again.

rajani :)

cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top