473,387 Members | 1,611 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

how to read dbf file using macro?

Hi,
i want to read each row of specific column of musa.dbf using macro
(VBA) in excel.
my main gole is to copy the data of dbf file to excel file.
I am new but want to do something..i tried and tried...and finally i am
here....
help me.

musa.biralo

Sep 15 '06 #1
2 12427
This is from the database side.
In Access:
Set up a simple select query that selects all the appropriatedbf data
Let's say that you name it qryDBFDataForExcel
Lets say you want to export the dbf data to an Excel spreadsheet with the
path and name of "c:\MyDBFInWkBk.xls

DoCmd.TransferSpreadsheet acExport, 8, "qryDBFDateForExcel",
"c:\MyDBFInWkBk.xls"

The acExport tells it that the data is outbound.
The 8 tells it to create Excel version Ofc97 or later.
The "qryDBFDateForExcel" tells it which query or table to export data from.
The "c:\myDBFInWkBk.xls" tells it what workbook to create and place the data
in and where that workbook will be located.

You will then have a spreadsheet with the column titles from the DBF
fieldnames and all the data from DBF under the appropriate
Column titles.

You can modularize this by using variables to store the query and file names
and then process any number of DBFs to excel.

__________________________________________________ __________________

On the other hand if you only have one dbf and want all of the data in the
DBF you can open Excel.
Go to File: Open and double click on the DBF filename. That will open the
file in Excel. You can then save it as an Excel workbook.
"musa.biralo" <mu*********@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
Hi,
i want to read each row of specific column of musa.dbf using macro
(VBA) in excel.
my main gole is to copy the data of dbf file to excel file.
I am new but want to do something..i tried and tried...and finally i am
here....
help me.

musa.biralo

Sep 15 '06 #2
Thank you Kc_Mass

Though i was not looking for this, i learned new things... and i really
appreciate the explanation you provide. Such explanation really helps
to understand the code.

musa.biralo

Kc-Mass wrote:
This is from the database side.
In Access:
Set up a simple select query that selects all the appropriatedbf data
Let's say that you name it qryDBFDataForExcel
Lets say you want to export the dbf data to an Excel spreadsheet with the
path and name of "c:\MyDBFInWkBk.xls

DoCmd.TransferSpreadsheet acExport, 8, "qryDBFDateForExcel",
"c:\MyDBFInWkBk.xls"

The acExport tells it that the data is outbound.
The 8 tells it to create Excel version Ofc97 or later.
The "qryDBFDateForExcel" tells it which query or table to export data from.
The "c:\myDBFInWkBk.xls" tells it what workbook to create and place the data
in and where that workbook will be located.

You will then have a spreadsheet with the column titles from the DBF
fieldnames and all the data from DBF under the appropriate
Column titles.

You can modularize this by using variables to store the query and file names
and then process any number of DBFs to excel.

__________________________________________________ __________________

On the other hand if you only have one dbf and want all of the data in the
DBF you can open Excel.
Go to File: Open and double click on the DBF filename. That will open the
file in Excel. You can then save it as an Excel workbook.
"musa.biralo" <mu*********@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
Hi,
i want to read each row of specific column of musa.dbf using macro
(VBA) in excel.
my main gole is to copy the data of dbf file to excel file.
I am new but want to do something..i tried and tried...and finally i am
here....
help me.

musa.biralo
Sep 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jabe | last post by:
I created a page on our intranet that shows a number and that increases for every time the page is opened. It is similar to a visitors-counter. When I look at the page with Internet Explorer it...
5
by: Tim Eliot | last post by:
Just wondering if anyone has hit the following issue and how you might have sorted it out. I am using the command: DoCmd.TransferText acExportMerge, , stDataSource, stFileName, True after...
11
by: Grim Reaper | last post by:
I am importing a .csv file into Access that has 37 fields. My problem is that sometimes the last field only has data at the end of the column (it looks like when you import a file into Access, for...
40
by: Abby | last post by:
My .dat file will contain information like below. /////////// First 0x04 0x05 0x06 Second 0x07
16
by: ben beroukhim | last post by:
I have huge number of legacy code which use standard files functions. I would like to pass a memory pointer rather than a FILE pointer. I am trying to use FILEs in the code to refer to memory...
9
by: Carramba | last post by:
#include <stdio.h> int main( void ){ char cQuit = 'a'; char cKommando , artistNamn , skivansNamn , cChar; int cK ; FILE *pekaFile; printf( "l - for read file\n"); printf( "s - for writte...
2
by: Pat_RI | last post by:
I am trying to call a macro using a command file by using Windows Scheduler. I am able to run the command file and the macro runs without issue if I doubleclick on the *.cmd file. When I try...
9
by: Adi | last post by:
Hello eveyone, I wanna ask a very simple question here (as it was quite disturbing me for a long time.) My problem is to read a file line by line. I've tried following implementations but still...
1
by: ashok0866 | last post by:
I had created a macro to read data from an excel sheet and write the values to a text file. I had used "ActiveSheet.Range("GB" & k).Value" command to read the values from the excel. The issue...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.