Results 1 to 3 of 3
  1. #1
    3 Star Lounger MacroAlan's Avatar
    Join Date
    Feb 2003
    Location
    St Louis, Missouri, USA
    Posts
    254
    Thanks
    6
    Thanked 1 Time in 1 Post

    Acces Temp Table creation

    I have been using a recordset to define a chunk of data I want to work with. We have decided that a temp table would be better so we could query against the smaller piece.

    I have forgotten the syntax for building the TempTable. This is what I came up with but it isn't right:
    Code:
    YvString = "SELECT * FROM YAV_Fc INTO YAVtemp"
        YvString = YvString & " WHERE ((Country="
        YvString = YvString & Chr(34) & Country & Chr(34)
        YvString = YvString & ") AND (MPG=" & Chr(34) & MPG & Chr(34) & ") AND "
        YvString = YvString & "(BasicM=" & Basic & ") AND "
        YvString = YvString & "(MG=" & Chr(34) & MG & Chr(34) & "))"
        YvString = YvString & " ORDER by CalenPer,Priority,ABCquality;"
        DoCmd.RunSQL YvString
    The variables are correct and worked when I was writing to RecordSet. I am using the astericks (*) because there are so many fields to pull.
    Alan

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    Try

    Code:
     YvString = "SELECT YAV_Fc.* INTO YAVtemp  FROM YAV_Fc "
    Regards
    John



  3. The Following User Says Thank You to johnhutchison For This Useful Post:

    MacroAlan (2011-03-09)

  4. #3
    Star Lounger tgw7078's Avatar
    Join Date
    Jul 2010
    Location
    Seattle, WA., USA
    Posts
    90
    Thanks
    1
    Thanked 12 Times in 12 Posts
    Hi MacroAlan,

    I have a sample database that is based on code provided by Access MVP Dirk Goldgar, which shows how to easily create a temporary work database using a "template" table, or any SELECT query (including crosstab queries). There's only one little restriction that involves the VBA editor option needs to be set to Break on Unhandled Errors, as opposed to Break on all Errors. If you distribute your application in the compiled .mde (.accde) form, then you need not worry about how this VBA option is set on a user's machine. The sample is located here:

    http://www.accessmvp.com/TWickerath/...s/tmpwrkdb.zip


    Tom Wickerath
    MS Access MVP
    2006 - 2011

  5. The Following User Says Thank You to tgw7078 For This Useful Post:

    MacroAlan (2011-03-17)

Tags for this Thread

Posting Permissions

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