• No records INTO table

    Author
    Topic
    #464841

    Hello. (Access 2003).
    I’m using DoCmd.RunSql from Visual Basic to execute make-table (INTO) queries. But I end up with a few
    blank tables.
    How can I test the SQL statement to see if it returns no records? Thanks, Andy.

    Viewing 1 reply thread
    Author
    Replies
    • #1191717

      Can’t you do a DCount on the table or query with the same where condition as in the sql statement ?
      Something like this :

      NumberOfRecords = DCount(“*”,”MyTableOrQuery”,”WhereStatement”)
      If NumberOfRecords > 0 Then
      DoCmd.RunSQL strSQL
      End If

    • #1191720

      Hey, I like that!
      I was going to create a recordset and count records..
      Thanks, Andy.

    Viewing 1 reply thread
    Reply To: No records INTO table

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: