Results 1 to 3 of 3

Thread: VBa Generated SQL for Access

  1. #1

    Thread Starter
    Fanatic Member Matt_T_hat's Avatar
    Join Date
    Dec 2001
    Location
    '76 Male Body Evil-Errors: 666
    Posts
    774

    Talking VBa Generated SQL for Access

    I have a VBa App that creates this SQL:

    UPDATE type INNER JOIN (select * from Mat_data in 'C:\sb-Data\sb\In Tray\New_18_1_2005.mdb') T1 ON type.SBKEY = T1.type_SBKEY SET Type.Name = [T1].[Type_name], Type.[Measure ID] = DLookup('[Measure ID]', '[Measure]', "'[Measure].[SBKey] = " & [T1].[Measure_SBKey] & "'"), Type.Wm_Ratio = dlookup("[id]", "[converter]","'[converter].[sbkey] = " & [t1].converter_sbkey & "'");

    This SQL takes almost five and a half minuets to run with a smallish data sample. That is far to slow.

    That's the challenge then a better way of asking for the same thing.
    ?
    'What's this bit for anyway?
    For Jono

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: VBa Generated SQL for Access

    If you replace * on select * from with all the column names of the table, you get a small speed advantage. It might be worth of nothing in this case, it is just a common trick used on forums to speed things up a little.

  3. #3
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: VBa Generated SQL for Access

    Don't use DLookup - its slow... very slow...

    What are you trying to do?

    EDIT:
    Join the other two tables in if possible...
    Sub queries?
    Last edited by Ecniv; Feb 4th, 2005 at 10:39 AM.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

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