Hi Vee
Dyou know why it has an error here?
When I connect to dbf it goes fine

Set db = OpenDatabase(App.Path & "\", False, False, "dBase IV;")

but when I make some query then it makes an error

Set Data1.Recordset = db.OpenRecordset("select * from [color] where clrcode='" & Text1.Text & "'")

hello everyone
can anyone tell me which path we have to set up to open a connection while using ADO and which path while Openin DAO Connection.
con .open ----------Both in ADO and DAO


what this mean
str = str & IIf(IsNull(rs(i)), "null", rs(i)) & Chr(9)
Else
str = str & IIf(IsNull(rs(i)), "null", rs(i))
reply soon
regads
suneel

Hi Jireh,

Change this :
Set db = OpenDatabase(App.Path & "\", False, False, "dBase IV;") To :

[B]Set db = OpenDatabase(App.Path, False, False, "dBase IV;")[/B]

Regards
Veena

hi
y i am getti msg from dani web that u have repied t my query but as u have replied t jiresh problem.
i dont have any book to refer rt now thats y i am askin every doubt to u .but no response frm u .
regards
suneel

I hope your problem is over now. How is my code? simple isn't it?

its too easy to grab really tellin u bro.
thoda sa prob he i have send u that inpvt msg .
reply soon
regards
suneel

No, not in opening the database...

the error is in here...

Set Data1.Recordset = db.OpenRecordset("select * from [color] where clrcode='" & Text1.Text & "'")

because I want to make a query on that dbf file (color.dbf) but it makes an error.

Hi Jireh,

It wont give u error while opening the Database, but still u need to change it..
remove last slash and check..
it is checking Color.dbf in a SubFolder in App.Path..
thats why change it to:
Set db = OpenDatabase(App.Path, False, False, "dBase IV;")

Regards
Veena

When you are tired and about to loose hope of connecting to dBASE file please contact me.

Happy Programming

AV Manoharan

hello bro manohaar
ur program worked but not for .dbf files but for .mdb files.
ur program is simply easy to understand
wht if for .dbf ffiles.it is writin data in txt file once only but
it should be like
no of records= no of txt files.
with high regards
suneel kr
bro if u dont mind may i haave ur gmaail id or cchaat id .


Private Sub Form_Load()
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i As Integer
'Dim OneRecord As String

con.ConnectionString = ("Driver={Microsoft dBASE Driver(*.dbf)};DriverID=277;Dbq=C\Suneel_Development\Project Code\AV Manoharan;")


'The above codes should be in one line and you have to
'replace E:\cofking\fa\dms with the pathname of your
'dBase File path, means upto the dBase filename.

Set fs1 = CreateObject("Scripting.FileSystemObject")
Set tstream = fs1.CreateTextFile("C:\Data.txt", True)
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\Dbase.mdb ; Persist Security Info=False"
If rs.State = 1 Then rs.Close
rs.Open "select * from Dbase", con
' here for myinv2.dbf you have to supply you dBase
'filename without pathname.
If rs.RecordCount = 0 Then
Command1.Caption = "Sorry! Nothig to Extract"
If rs.State = adStateOpen Then
rs.Close
End If
Set rs = Nothing
Set con = Nothing
Exit Sub
Else
rs.MoveFirst
End If
' The below loop examines each record uoto EOF
' The FOR loop inside it write to your file data.txt
' each fields of a record with a coma seperator. If any
' field is null it just insert a coma inplace. This is
' for excel compatibilty. and the last character of the
' record is a carriage return.
Do While Not rs.EOF
For i = 0 To rs.Fields.Count - 1
If rs.Fields(i) = Null Then
tstream.Write (",")
Else
tstream.Write (rs.Fields(i) & ",")
End If
Next
tstream.Write (Chr(13))
rs.MoveNext
Loop
tstream.Close
If rs.State = adStateOpen Then
rs.Close
End If
Set rs = Nothing
Set con = Nothing
Command1.Caption = "Successfully Extracted"
End Sub

Sub command1_click()
Unload Form1
End Sub

Suneel,
That's not the code segment sent by me. You have altered it.

Why did you do it and blame me that the code is not working. I have tested it fully.

Again cut and paste the code exactly as I have sent. only places you are supposed to change are the path of your dBASE file and in the select clause the dBASE file name including its extension .dbf, without path.

In my code there is only
con.open
nothing more.
Your con open will open only ACCESS database.

The loop of writing the record is as below.
Do While Not rs.EOF
For i = 0 To rs.Fields.Count - 2
If rs.Fields(i) = Null Then
tstream.Write (",")
Else
tstream.Write (rs.Fields(i) & ",")
End If
Next
If rs.Fields(i) = Null Then
tstream.Write (",")
Else
tstream.Write (rs.Fields(i) )
End If
tstream.Write (Chr(13))
rs.MoveNext
Loop

Out side the FOR loop it will write a Coma if the last field is null otherwise its value and terminate it with Carriage return.

This is to comply with spreadsheet format.

Have you done the preliminary things that I have told you to do ?
please get back to me after doing all the things.


happy programming

AV Manoharan

bro
itt is givin me one error " [microsoft][OBDC Driver maanaager]Data source name not found and no default driver selected."
plz reply wt i have to do wid obdc
regards
suneel

bro
itt is givin me one error " [microsoft][OBDC Driver maanaager]Data source name not found and no default driver selected."
plz reply wt i have to do wid obdc
regards
suneel

Open the control pannel select Administrative tools select ODBC select dBASE Files, Press ADD button, and select Microsfot dBase Driver click finish,OK

dataa source naame:
Description:
wt tto write in that
hey bro plz reply i aam saayin n a kal se book pad ke aaongaa prromise
regrars
ssuneel

dataa source naame:
Description:
wt tto write in that

in the window ODBC Data Source Administrator

Select File Dsn

In the Look in It has to be Data Sources
In the rectangle below the default Inv will be shown
double clicking the mouse on it you will get another window

In that version you select dBase IV
Click Ok

good mornin big B
as per ur instructions i
1select control pannnel
2.Adminstrative tools
3 Database sources
4 File DSN
5 In Data sorces
default was dBase.dsn
6 i double clicked on that
7. slected dBase 4
8 then presed ok

but still it is showing no default driver is selected.
if i have done anythin wrong plz rectify.
with regrds
suneel kar

in the window ODBC Data Source Administrator

Select File Dsn

In the Look in It has to be Data Sources
In the rectangle below the default Inv will be shown
double clicking the mouse on it you will get another window

In that version you select dBase IV
Click Ok

plz chk gmail
regards
suneel

HEY VEENA
itna gussa nt good .i was just sayin na ki conecrned persons told methat it is already installed.
anyways thanx
suneel

good mornin big B
as per ur instructions i
1select control pannnel
2.Adminstrative tools
3 Database sources
4 File DSN
5 In Data sorces
default was dBase.dsn
6 i double clicked on that
7. slected dBase 4
8 then presed ok

but still it is showing no default driver is selected.
if i have done anythin wrong plz rectify.
with regrds
suneel kar

Pull down the menu 'Project' and in it the references.
just see what types are checked. Please see in the preceeding section of this thread that I have explained to you.

And get back to me

regards
AV Manoharan

from top 5 chckboxes r checked

1. visual basic for applications
2vb run time ablects
3vb objects aand procedures
4 OLE automation

5 .Microsoft Activex dataobjects 2.5 library
above this all r checked.
regards
suneel


Pull down the menu 'Project' and in it the references.
just see what types are checked. Please see in the preceeding section of this thread that I have explained to you.

And get back to me

regards
AV Manoharan

from top 5 chckboxes r checked

1. visual basic for applications
2vb run time ablects
3vb objects aand procedures
4 OLE automation

5 .Microsoft Activex dataobjects 2.5 library
above this all r checked.
regards
suneel

The top 4 are defaulted.
That is up to OLE automation
then,
check microsoft jet and replication objects
microsoft ado ext.2.8
microsoft activex data objects
microsoft DAO 3.6 (incase the ADO doesn't work)

Regards

AV Manoharan

microsoft ado ext.2.8
it is not there .
after selectin all u said it is sayin conflicts with the library.
pressin ok aafter this saame error iss coming

one thing i noticed is when i go in control pannel----> Adminstrative tools------->daata sorce OBDC----->fileDSN------>double clicked on dBase.dsn---->selectin dBae4
apply button is not highlighted

dirctry i selected is where my .dbf file is thats
C:\Suneel_Development\Project Code\manohar

hello bro where r u.y u not replyin
regards
suneel

hello bro
u there naa .
rreply

microsoft ado ext.2.8
it is not there .
after selectin all u said it is sayin conflicts with the library.
pressin ok aafter this saame error iss coming

one thing i noticed is when i go in control pannel----> Adminstrative tools------->daata sorce OBDC----->fileDSN------>double clicked on dBase.dsn---->selectin dBae4
apply button is not highlighted

dirctry i selected is where my .dbf file is thats
C:\Suneel_Development\Project Code\manohar

That means you did not follow my instructions put in the thread, Read Me: Aceess to any DB's Possible. Any how. I will cut and paste for you here:

Follow as bellow, carefully.

Before copying the text code into you project, Open a new exe project, pull down the menu project, then select components. in components control pannel check the following item.

ctv OLE Control Module
Microsoft ADO Data Control 6.0 (sp6)(OLEDB)
Microsoft Datagrid control 6.0) ..

Press OK

Now Go to references in the same Project window
and see the following are checked

The top 4 are defaulted.
That is up to OLE automation
then,
check microsoft jet and replication objects
microsoft ado ext.2.8
microsoft activex data objects
microsoft DAO 3.6 (incase the ADO doesn't work)

Click ok

create a form with one commandbutton
click the code window from the right pan
and select form local

paste my code

change the path of your dbf file in the connection string.

Do not alter the connection string.

run it

I think your problem has to be solved with this.
Else
Get back to me.

regards
AV Manoharan

Private Sub Form_Load()
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i As Integer
Dim OneRecord As String

con.ConnectionString = ("Driver={Microsoft dBASE Driver(*.dbf)};DriverID=277;Dbq=C:\Suneel_Development\Project Code\Manohar;")

'The above codes should be in one line and you have to
'replace E:\cofking\fa\dms with the pathname of your
'dBase File path, means upto the dBase filename.

Set fs1 = CreateObject("Scripting.FileSystemObject")
Set tstream = fs1.CreateTextFile("C:\Data.txt", True)
con.Open
rs.Open "select * from dBase.dbf", con
' here for myinv2.dbf you have to supply you dBase
'filename without pathname.
If rs.RecordCount = 0 Then
Command1.Caption = "Sorry! Nothig to Extract"
If rs.State = adStateOpen Then
rs.Close
End If
Set rs = Nothing
Set con = Nothing
Exit Sub
Else
rs.MoveFirst
End If
' The below loop examines each record uoto EOF
' The FOR loop inside it write to your file data.txt
' each fields of a record with a coma seperator. If any
' field is null it just insert a coma inplace. This is
' for excel compatibilty. and the last character of the
' record is a carriage return.
Do While Not rs.EOF
For i = 0 To rs.Fields.Count - 1
If rs.Fields(i) = Null Then
tstream.Write (",")
Else
tstream.Write (rs.Fields(i) & ",")
End If
Next
tstream.Write (Chr(13))
rs.MoveNext
Loop
tstream.Close
If rs.State = adStateOpen Then
rs.Close
End If
Set rs = Nothing
Set con = Nothing
Command1.Caption = "Successfully Extracted"
End Sub

Sub command1_click()
Unload Form1
End Sub

just see the code once
i hav done everythin a u sai d
still same error is comin

****microsoft ado ext.2.8: not found

click the code window from the right pan
and select form local : wtss this not understood this*****

wt to say u bro i am not able to do thee things dont know y but still u r wid me .thanx alot

u there brother

Suneel,
Have you got my Zip file as an attachment?

Please do as I have explained to you.

regards
AV Manoharan

Cant Find Project Or Library
Regaards
Ssuneel

goodd mornin big B
where r u. am waaitin for u.
come online early am waitin .hope u understand

with high regards
suneelkar


project is givin "cant find project library" error

Dear Suneel,

So it has worked.

Code? That I have already despatched to you.
So nothing wrong with the code.

Now I will tell you what and where you went wrong. Before that let me take my lunch.

I will be back on the thread after 3

regards
AV Manoharan

ok big B
as u wish.
bro i am thnful to u .for being so patient.
u got the qualities of a teacher .real teacher,the guru.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.