• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 158
  • Last Modified:

Connect Datacontrol to textfile

I need the exact code to link a text file or excel file to a data control.

assume the datacontrol is data1.
assume the textfile is located "C:\windows\desktop\myfile.txt"

I know how to do this with the property, but I want to set it at runtime.

Thanks!
0
thien
Asked:
thien
  • 2
1 Solution
 
dabelleiCommented:
   Data1.Connect = "Text;"
    Data1.DatabaseName = "d:\struct"
    Data1.RecordSource = "users#txt"

replace the d:\struct  by the path of the file
repale "users#txt"  with the name of your file  (keep the #txt)


0
 
thienAuthor Commented:
Thanks, can you tell me how to connect to excel, Thanks!
0
 
dabelleiCommented:
    Data1.Connect = "Excel7.0;"

Just change the connect type with the one you need, don't forget to mentionned the excel version.

0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now