Results 1 to 2 of 2
  1. #1
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496

    is this a valid SQL statement ? (simple)

    I want to copy a record from a table that has lots of fields to a table with the exact same structure (but am trying not to have to list every one of the fields values...)

    Is this a valid statement (below)? (It's giving me problems executing and I wonder if I'm trying to do something in a way that simply cannot be done)

    (note the suffix of the 2 tables is different: tbe and tbl)

    sSQL = "INSERT INTO tbeFixtureSchedulePrintOptions" _
    & "SELECT * '" _


    & "from tblFixtureSchedulePrintOptions " _
    & "WHERE [PresetOption] = " & Me.cboPresetOption
    DoCmd.SetWarnings False
    DoCmd.RunSQL sSQL
    DoCmd.SetWarnings True

    many thanks in advance,
    mark

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I always specify the fields, but right off it looks like you won't have a space between the table name and SELECT. If it still doesn't work, add this after the string is built:

    Debug.Print sSQL

    which will print out the finished SQL to the VBA Immediate window. You can copy/paste it into a new query and try to run it. You'll typically get a more descriptive error.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Checking user input is valid
    By AccessPoint in forum Access
    Replies: 4
    Last Post: 07-18-2010, 06:43 PM
  2. Replies: 17
    Last Post: 03-09-2010, 07:00 AM
  3. Save backup as valid name
    By timpepu in forum Access
    Replies: 0
    Last Post: 12-18-2009, 03:03 AM
  4. Replies: 2
    Last Post: 08-26-2009, 10:43 AM
  5. Replies: 1
    Last Post: 07-21-2009, 03:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums