Hunter
November 8th, 1999, 10:14 PM
can someone help me get this to work faster/better i am using vb6.0 and trying to open a dBASE IV "zipcode" DBF
i've tried to get the database to open directly and have run out of ideas
so i made a datacontrol and set its properties as follows:
.visible=false
.connect=dbase IV;
.DatabaseName=C:\my documents
.Default type= 2-usejet (UseODBC Fails to open the DBF)
.record type=1-Dynaset(all seem to run about the same speed)
.recordsource=NCs_Zip
i then use the datacontrol to open the database as follows
this way is VERY SLOW (about 35 seconds to a min' to get a response!)
the Zip code database(NCS_ZIP) has @ 98000 records and needs to stay in DBASE IV format ( i use a similar code in access to get info from an access table and it is very fast) so i think there must be a better way to directly connect to this NCS_Zip.dbf so it will search/return info faster.
Dim tempzip As String
tempzip = Zip.Text
Dim db As Database
Set db = Data2.Database
Dim rs As Recordset
MousePointer = vbHourglass
Set rs = db.OpenRecordset("select distinctrow Ncs_Zip.City,Ncs_Zip.State from Ncs_Zip where Ncs_Zip.Zip= '" & tempzip & "'")
If rs.EOF Then
City.Text = ""
State.Text = ""
MousePointer = vbNormal
MsgBox "Zip code not found"
Exit Sub
Else
City.Text = rs!City
State.Text = rs!State
MousePointer = vbNormal
End If
thanks ahead of time for your help
hunter
i've tried to get the database to open directly and have run out of ideas
so i made a datacontrol and set its properties as follows:
.visible=false
.connect=dbase IV;
.DatabaseName=C:\my documents
.Default type= 2-usejet (UseODBC Fails to open the DBF)
.record type=1-Dynaset(all seem to run about the same speed)
.recordsource=NCs_Zip
i then use the datacontrol to open the database as follows
this way is VERY SLOW (about 35 seconds to a min' to get a response!)
the Zip code database(NCS_ZIP) has @ 98000 records and needs to stay in DBASE IV format ( i use a similar code in access to get info from an access table and it is very fast) so i think there must be a better way to directly connect to this NCS_Zip.dbf so it will search/return info faster.
Dim tempzip As String
tempzip = Zip.Text
Dim db As Database
Set db = Data2.Database
Dim rs As Recordset
MousePointer = vbHourglass
Set rs = db.OpenRecordset("select distinctrow Ncs_Zip.City,Ncs_Zip.State from Ncs_Zip where Ncs_Zip.Zip= '" & tempzip & "'")
If rs.EOF Then
City.Text = ""
State.Text = ""
MousePointer = vbNormal
MsgBox "Zip code not found"
Exit Sub
Else
City.Text = rs!City
State.Text = rs!State
MousePointer = vbNormal
End If
thanks ahead of time for your help
hunter