Click to See Complete Forum and Search --> : load .dbf file into a listbox


mbw
October 4th, 2001, 09:58 AM
I want to load a single dbase file into a listbox. Any suggestions would be great! Thanks.

Iouri
October 4th, 2001, 10:04 AM
Create a recordset for the field(s) that you need and enter it to the listbox.

List1.AddItem rs!Field1 & " " & rs!Field2

If you need a connection string for dbase, let me know

Iouri Boutchkine
iouri@hotsheet.com

mbw
October 4th, 2001, 10:17 AM
Thanks for the tip. I know how to create a connection for a database that stays in one place. But my problem is that I want to allow the user to specify where the .dbf file is stored.

For example, the user is asked to specify where the .dbf file is stored. Once they specify the location the .dbf files needs to be read into the listbox. I guess my question is how do I create a connection that is dynamic? My experience has only been with connecting to a database that stays in one place.

Iouri
October 4th, 2001, 12:29 PM
On a button click bring an InputBox where user can enter the database path (or you can use Dialog Box). Assign path to the variable (DBFPATH) and then create the connection string

sConn = "Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=" & DBFPATH & ";"

Here we go. We eill connect to the chosen location.

Iouri Boutchkine
iouri@hotsheet.com