Results 1 to 3 of 3

Thread: Help to update a database

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Posts
    118

    Post

    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

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    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


  3. #3
    Member
    Join Date
    Apr 1999
    Location
    Kirkland, WA, USA
    Posts
    40

    Post

    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
  •  



Click Here to Expand Forum to Full Width