Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Francois

  3. #3
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey, I like that!
    I was going to create a recordset and count records..
    Thanks, Andy.

Posting Permissions

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