Thread: files import
View Single Post
  #1  
Old 05-11-2004, 14:05
graphicdesigner
Guest
 
Posts: n/a
Default files import

how do i get data from datbase or comma delimilted or tab delimilted files or excel

when i click on the import button i should be be to open the required file.
get the first record from the file to the corel document for eg

i can click next to goto next record and also cick on previous to go the previous record just in case if the user wants to chnage something
in the previuos record

now i have a button name cmd_import_click

and i have the following code
which opens an excel file how do i connect the above button to open all the files of different type and diffrent names .
something like a browse button will do thake me to the location and open the file for me.and do the above stuff when i click
next and previous button.i know printmerge allows u to do something like this but printmerge takes all the values(fields) in from the file
Sub ReadExcel()
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim s As String

' Open the connection to an Excel file
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\data.xls;" & _
"Extended Properties=""Excel 8.0; HDR=No;"""

rs.Open "SELECT * FROM [Tabelle1$a1:a13]", cnn, _
adOpenForwardOnly, adLockReadOnly

s = ""

While Not rs.EOF
If s <> "" Then s = s & vbCrLf
s = s & rs!F1
rs.MoveNext
Wend

rs.Close
cnn.Close
Set rs = Nothing
Set cnn = Nothing


End Sub
Reply With Quote