access SQL and temporary table?

Need to create temporary table using Microsoft Access and SQL. My syntax doesn't seem to be working.

Anybody have a simple example?

4 Answers

Relevance
  • Aaron
    Lv 4
    1 decade ago
    Best Answer

    I made a form with text boxes to capture the table name, field names and types. (tableName, fieldName1, fieldtype2, fieldName2, fieldType2)

    Then I made a button with an onclick event:

    sqlStr = "CREATE TABLE " & Me!tableName & _

    " (" & Me!fieldName1 & " " & Me!fieldtype1 & ", " _

    & Me!fieldname2 & " " & Me!fieldtype2 & ");"

    DoCmd.RunSQL sqlStr

    HTH - Good Luck

    -Aaron

  • 1 decade ago

    Use ordinary syntax for creating a table with prefix '#' for local temporary table or '##' for global temporary table, for example:

    CREATE TABLE #T1 (<column definition>)

  • 1 decade ago

    Have you tried F1 - Are you creating the table from a query, report, table?

  • 1 decade ago

    SELECT * INTO #temp_table1

    FROM myTable

    If memory serves me correct.

Still have questions? Get your answers by asking now.