?
Solved

Connect Datacontrol to textfile

Posted on 1998-09-23
3
Medium Priority
?
154 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
dabellei earned 150 total points
ID: 1436296
   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
ID: 1436297
Thanks, can you tell me how to connect to excel, Thanks!
0
 
LVL 2

Expert Comment

by:dabellei
ID: 1436298
    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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

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