Results 1 to 4 of 4

Thread: creating macro

  1. #1
    Join Date
    Jun 2007
    Posts
    2

    Unanswered: creating macro

    Hi all. Being new with MS Access, I don't quite know how to put together a macro for this requirement that I'm working on. I would really appreciate all the help that I can get. Here it is:

    I need to create a macro that would allow me to:
    1. look at the accountID on a csv file
    2. match it with the accountID on the accountInfo table
    3. grasp the partID from the accountInfo in the accountInfo table
    4. update the partID on the csv file using the partID from the accountInfo table.

    Thanks in advance.

  2. #2
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    is the csv file linked? if not, link it.

    create queries to manipulate your data

    create a macro (if this is going to be run from a form - I'd go with VBA here instead of a macro) to run the queries in order

  3. #3
    Join Date
    Jun 2007
    Posts
    2
    Thanks Rogue. I tried your suggestion by linking the csv and then create a new table for the csv (text file) - (is it the right way to link csv file?). But then I got stuck because I don't know how to do an update statement to join the new table with the existing table. I attempted to put together an update statement but I couldn't get it to finish. Can anyone please look at the update statement and give me advise or let me know if I'm on the right track or not. Thanks in advance.

    Here's the update statement:

    update mytest
    set field1 = (select accountID
    from existingtable
    where partID = field3)

  4. #4
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    Use the query builder.

    Link the csv file then create a new query and use the linked table in the query. Change the query type to update. If you need the actual SQL code switch to SQL view.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •