|
-
Aug 7th, 1999, 08:51 PM
#1
Thread Starter
Lively Member
Hi
Is there a way I can update a access database with a text file. The idea is that I have these price files in txt form but then I have to use access to make them into a database , If i could write a program to read the txt file and transfer it to a.mdb file with the index set to Number it would save me steps.
Thanks for any help.
Paul
-
Aug 8th, 1999, 12:45 AM
#2
Frenzied Member
Without knowing the structure of the data file, it's hard to give advice on how to import it into the database.
The following can be used to update a record (if you know which record and which field needs to be updated). Bound controls not required:
[not tested]
Dim DB as database
dim sSql as string
Set db = workspaces(0).Opendatabase("dbname")
sSql = "update tablename set field='" & valuefromfile & "' where key=uniquevalue"
'for a numeric value use
'sSql = "update tablename set field=" & valuefromfile & " where key='" & uniquevalue & "'"
db.execute sSql, dbfailonerror
-
Aug 8th, 1999, 03:01 AM
#3
Member
Do you have to actually import to theJet file? If so it's pretty easy, first link the text file to a temp jet file, then do this against it :
dim sSQL as string
sSQL = "SELECT * INTO [--qualified path to jet file--].[--table to create or add to--] FROM tblLinedtoTextFile"
dbTempHoldingLink.Execute sSQL
----
Or you could just link the text file directly to the main Jet file and use an Append or Make Table query.
----
There is a link called "Relational Text Files!" at
http://www.smithvoice.com/vbfun.htm
that shows this kind of stuff. Maybe it will give you a bit of help.
-Robert
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|