473,396 Members | 1,966 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,396 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 12429
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.