Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2003
    Posts
    25

    Question Unanswered: make-table query

    Hi friends

    I have a make-table query running from a form. However, whenever it runs a message appears that the table will be deleted and new data will be placed etc etc.

    HOW do I hide this message so that the query runs without any user interations.



    Many thanks



    Phil

  2. #2
    Join Date
    Nov 2001
    Posts
    336
    The following example turns the display of system messages off:

    DoCmd.SetWarnings False

  3. #3
    Join Date
    Nov 2001
    Posts
    336
    Hi,

    Disregard my prev. post. Here is some more reliable way to achieve required functionality:

    Private Sub cmdMakeTable_Click()
    On Error GoTo MyError

    DoCmd.SetWarnings False
    CurrentDb().Execute "SELECT tblCompanies.CompanyID, tblCompanies.CompanyName INTO table1 FROM tblCompanies;"

    MyExit:
    Exit Sub

    MyError:
    Select Case Err.Number
    Case 3010
    Err.Clear
    CurrentDb().Execute "Drop Table table1;"
    Resume
    Case Else
    MsgBox Err.Description, vbCritical, "Error"
    GoTo myexit
    End Select

    End Sub

  4. #4
    Join Date
    Jul 2003
    Posts
    25

    Thumbs up Thanks

    Many thanks - it works fine.




    Cheers



    Phil

  5. #5
    Join Date
    May 2002
    Location
    London
    Posts
    87
    In the example you don't need the SetWarnings False if as are using the execture method. However I would advise that you add the dbFailOnError option so you know if there were any problems.

    In general I prefer to delete all the records in the destination and then run an append as it allow me to keep the indexing, formats and comments from the original table, but this may not be relevant to your situation.

Posting Permissions

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