Solved

Connect Datacontrol to textfile

Posted on 1998-09-23
3
150 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
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

773 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