+ Reply to Thread
Results 1 to 9 of 9

Double Handling within working code Write to access and fire access macro

  1. #1
    Registered User
    Join Date
    10-22-2014
    Location
    Birmingham UK
    MS-Off Ver
    Various
    Posts
    55

    Double Handling within working code Write to access and fire access macro

    Hi

    I have put this together but i dont think it is optimal.
    The Macro is calling another Sub (UploadParameterDates) (i have done this seperatly as i may need to call just this macro)
    The code then creates an access object to fire a 7 stage access macro (Various update queries etc) then closes down access

    Please could you see if it could be refined? would excell handle the queries im running within access?

    Which metod would boost performance of the code? using Excel to call the macro from access or Excel doing the queries?

    Thanks



    Code for UploadParameter Dates
    Please Login or Register  to view this content.
    Code to be optimised/Edited

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Double Handling within working code Write to access and fire access macro

    Couldn't you do everything in Access, or Excel?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    10-22-2014
    Location
    Birmingham UK
    MS-Off Ver
    Various
    Posts
    55

    Re: Double Handling within working code Write to access and fire access macro

    I Believe I could but i would need some support converting the access queries that are running so they would work in Excel.

    Ive posted some examples below of the queries in access.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    [/CODE]
    UPDATE Archive SET Archive.HashTag = (IIf(IsNull([Details]),"#Free",IIf(InStr([Details],"#")>0,IIf(InStr(InStr([Details],"#"),[Details]," ")>0,Mid([Details],InStr([Details],"#"),InStr(InStr([Details],"#"),[Details]," ")-InStr([Details],"#")),Mid([Details],InStr([Details],"#"),999)),IIf(InStr([Details],"Bank Holiday")>0,"#hols",IIf(InStr([Details],"Holiday")>0 Or InStr([Details],"Leave")>0,"#Hols",IIf(InStr([Details],"Training")>0,"#Trng",IIf(InStr([Details],"Routine")>0,"#ROUT",IIf(InStr([Details],"left")>0,"#left",IIf(InStr([Details],"Directed")>0,"",IIf(InStr([Details],"Dutie")>0,"#Other",IIf(InStr([Details],"prep")>0,"#Prep",IIf(InStr([Details],"maint")>0,"#mtce"))))))))))))
    WHERE (((Archive.HashTag) Is Null) AND ((Archive.UploadDate)=Date()));

    [/CODE]
    Last edited by robtuby; 02-11-2015 at 09:21 AM. Reason: Code

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Double Handling within working code Write to access and fire access macro

    I don't see why you shouldn't be able to execute those queries just are you are executing these queries.
    Please Login or Register  to view this content.
    I might even be tempted to try using the query names rather than the SQL.

  5. #5
    Registered User
    Join Date
    10-22-2014
    Location
    Birmingham UK
    MS-Off Ver
    Various
    Posts
    55

    Re: Double Handling within working code Write to access and fire access macro

    its the arger of the queries i will struggle with where they are not importing or deteting data such as
    Please Login or Register  to view this content.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Double Handling within working code Write to access and fire access macro

    What would be the problem with running that query from Excel?

  7. #7
    Registered User
    Join Date
    10-22-2014
    Location
    Birmingham UK
    MS-Off Ver
    Various
    Posts
    55

    Re: Double Handling within working code Write to access and fire access macro

    There shouldnt be a problem, Ive just been trying this since your last post

    What ive done is:

    Open the Access DB.
    Gone into the Query Design mode and SQL view (Ive posted the SQL below)
    Pasted into VB and added .Execute and the Speech marks .

    Ive getting errors such as syntax, Doesnt like "*" or any of the other speech marks.

    Any ideas?

    SQL's Below

    Please Login or Register  to view this content.
    Last edited by robtuby; 02-11-2015 at 11:52 AM. Reason: edit

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Double Handling within working code Write to access and fire access macro

    In the query change the " to '.

  9. #9
    Registered User
    Join Date
    10-22-2014
    Location
    Birmingham UK
    MS-Off Ver
    Various
    Posts
    55

    Re: Double Handling within working code Write to access and fire access macro

    This one is Erroring with a Runtime ?????

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Access form works with access Viewer but not full version of Access?
    By Shanyn in forum Access Tables & Databases
    Replies: 1
    Last Post: 10-22-2014, 01:14 PM
  2. Is it possible to write macro to access multiple workbook in a directory
    By Manoj Vasanth G in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-09-2014, 07:45 AM
  3. Make the code working for Access backend
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-27-2011, 03:29 AM
  4. Only execute code on a write-access basis, not read-only
    By thompsy121 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-06-2009, 07:02 AM
  5. Fire Access Make-Table Query from Excel
    By afiack in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-11-2007, 07:43 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1