473,325 Members | 2,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Linked Table Question

I've developed an app that allows the user to choose a text file to link to
using the TransferText method. It works fine but I want to mitigate for the
user choosing the wrong file. I thought I'd do this by testing the linked
file for the existance of a certain header (field) name but am not sure what
method/syntax to use.

Any suggestions (other than buy a book)?

Many thanks.

Keith.

Sep 19 '07 #1
3 1651
"Keith Wilby" <he**@there.comwrote in message
news:46**********@glkas0286.greenlnk.net...
I've developed an app that allows the user to choose a text file to link
to using the TransferText method. It works fine but I want to mitigate
for the user choosing the wrong file. I thought I'd do this by testing
the linked file for the existance of a certain header (field) name but am
not sure what method/syntax to use.
This is what I have so far:

DoCmd.TransferText acLinkDelim, , "csvWindchill", strFilePath, True 'Link to
the chosen file
Dim tdf As TableDef
Set tdf = db.CreateTableDef("csvWindchill")
tdf.SourceTableName = "csvWindchill"
If Not tdf.Fields("Progress Plan") Then ...

but the last line is obviously not right. I can trap the "item not found in
this collection" error but there must be a more elegant way to do this.

Thanks.
Keith.

Sep 19 '07 #2
On Wed, 19 Sep 2007 14:26:10 +0100, "Keith Wilby" <he**@there.com>
wrote:

I'm assuming you prompt the user for the file by popping up a
File/Open dialog. After it returns with a full path, before attaching
the file, I would use regular file i/o functions like Open, Line Input
etc to test the file.
Alternatively you can go ahead and attach any file, and then use
database queries and/or DAO code to test the data.

Here is one test of the attached table:
if currentdb.tabledefs("MyTextFileTable").Fields.Coun t <10 then
MsgBox "Aarrrccchhh, I was expecting 10 columns", vbCritical
end if

-Tom.

>I've developed an app that allows the user to choose a text file to link to
using the TransferText method. It works fine but I want to mitigate for the
user choosing the wrong file. I thought I'd do this by testing the linked
file for the existance of a certain header (field) name but am not sure what
method/syntax to use.

Any suggestions (other than buy a book)?

Many thanks.

Keith.
Sep 19 '07 #3
"Tom van Stiphout" <no*************@cox.netwrote in message
news:9q********************************@4ax.com...
On Wed, 19 Sep 2007 14:26:10 +0100, "Keith Wilby" <he**@there.com>
wrote:
Here is one test of the attached table:
if currentdb.tabledefs("MyTextFileTable").Fields.Coun t <10 then
MsgBox "Aarrrccchhh, I was expecting 10 columns", vbCritical
end if
Thanks Tom.

Sep 20 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
2
by: MX1 | last post by:
This is weird. I'm trying to make a subform on a form and have it show the entries from one of my tables. The odd thing is that when I look at the table itself, I can see a "+" sign next to each...
5
by: b b | last post by:
I created the following code to delete all linked tables in my database (Access 200): -------------------------------------------------------- Dim tbl As TableDef Dim dbs As Database Set dbs...
7
by: smd | last post by:
Hello and thanks for taking the time to read this. I've looked all over the web and newsgroups and can't find a solution to my problem. I've posted this question to the Access 2000 group as well -...
2
by: Jill Elaine | last post by:
I am building an Access 2002 frontend with linked tables to an encrypted Paradox 7 database. When I first create these linked tables, I'm asked for the password to the encrypted Paradox database,...
10
by: Jim Devenish | last post by:
I have a split front end/back end system. However I create a number of local tables to carry out certain operations. There is a tendency for the front end to bloat so I have set 'compact on...
0
by: Grip | last post by:
Hi, I have gone throught the group and Microsoft's online help and have seen many suggestions but I am still seeking clarity: 1. I have an excel spreadsheet. Column A contains text that may...
3
by: nzaiser | last post by:
Hello! This is my first time asking a question here, so please bear with me if I seem 'unconventional!' My issue is this..... OS: Windows_NT App: MS Access 2000 (also in 2003) ODBC linked...
1
by: tbeer | last post by:
Hello. I have created a 2007 database to help organize a golf outing event which requires the collection and tracking of a lot of linked data. Everything in my dbase is linked to my Main Business...
18
by: afromanam | last post by:
Whew.. OK, running access 2003 in win xpsp2 and access 2007 in win vista. This is the question... We have a db, split in front end (FE.mdb) and backend (BE.mdb) FE has tons of linked...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.