Solved

Connect Datacontrol to textfile

Posted on 1998-09-23
3
148 Views
Last Modified: 2010-04-30
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
Comment
Question by:thien
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
dabellei earned 50 total points
Comment Utility
   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
 

Author Comment

by:thien
Comment Utility
Thanks, can you tell me how to connect to excel, Thanks!
0
 
LVL 2

Expert Comment

by:dabellei
Comment Utility
    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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now