Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2009
    Posts
    15

    Unanswered: Vba Msaccess Creatte query in vba to update table on another database

    Hey guys.

    I am working on a project at work. How can i write an update query in vba to update a table in another database (ms access also)

    and also how can i write in vba sql to say for example update field1 to say "Release" i have tried it as [Release] as status or "release as status or (release) as status... none work please help

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    496
    Provided Answers: 24
    Attach the external table into your db, then run the query.
    You can relabel fields in a query,
    NewLbl: RegFieldLbl

  3. #3
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    995
    Provided Answers: 2
    Database 1: D:\Some\Directory\Structure\foo.accbd
    Database 2: F:\Other\Path\bar.accdb

    From 1 to 2:
    Code:
    UPDATE [Table] IN 'F:\Other\Path\bar.accdb' SET [Field1] = 'NewValue' WHERE [Field2] = 'Whatever';
    From 2 to 1:
    Code:
    UPDATE [DifferentTable] IN 'D:\Some\Directory\Structure\foo.accbd' SET [Field3] = False WHERE [Field4] <= Now();
    To rename fields:
    Code:
    SELECT [Field1] AS Release, [Field2] AS OtherName FROM ThisTable;
    You will need to customise the values according to your requirements.
    10% of magic is knowing something that no-one else does. The rest is misdirection.

Posting Permissions

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