[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 370
  • Last Modified:

VBA SQL Query

I am recieving an error from the follwing code:

DoCmd.RunSQL "SELECT DISTINCT Pools.ExternalPoolID, Claims.SystemCreatedDate, " & _
"Claims.GNumber, Claims.ClaimID INTO MATT_REPORTING_STAGE1" & _
"FROM Pools INNER JOIN Claims ON Pools.PoolID = Claims.PoolID" & _
"WHERE (((Pools.ExternalPoolID)=""00000"" Or (Pools.ExternalPoolID)=""00001"" Or (Pools.ExternalPoolID)=""00002"")" & _
"AND ((Claims.SystemCreatedDate)<Now()-30) AND ((Claims.DateDeleted) Is Null));"

The error is "Runtime error '3067' : The query input must contain at least one table or query"

I thought this error happened when a table didnt exist that was in the query, but all 3 do, any ideas?

Thanks
Matt
0
generali
Asked:
generali
2 Solutions
 
mbizupCommented:
I think you need to add some  spaces...

DoCmd.RunSQL "SELECT DISTINCT Pools.ExternalPoolID, Claims.SystemCreatedDate, " & _
"Claims.GNumber, Claims.ClaimID INTO MATT_REPORTING_STAGE1" & _
" FROM Pools INNER JOIN Claims ON Pools.PoolID = Claims.PoolID" & _
" WHERE (((Pools.ExternalPoolID)=""00000"" Or (Pools.ExternalPoolID)=""00001"" Or (Pools.ExternalPoolID)=""00002"")" & _
" AND ((Claims.SystemCreatedDate)<Now()-30) AND ((Claims.DateDeleted) Is Null));"
0
 
peter57rCommented:
Hi generali,
You are missing some spaces at the end of lines...

 DoCmd.RunSQL "SELECT DISTINCT Pools.ExternalPoolID, Claims.SystemCreatedDate,  " & _
 "Claims.GNumber, Claims.ClaimID INTO MATT_REPORTING_STAGE1 " & _
 "FROM Pools INNER JOIN Claims ON Pools.PoolID = Claims.PoolID " & _
 "WHERE (((Pools.ExternalPoolID)=""00000"" Or (Pools.ExternalPoolID)=""00001""  Or (Pools.ExternalPoolID)=""00002"") " & _
 "AND ((Claims.SystemCreatedDate)<Now()-30) AND ((Claims.DateDeleted) Is Null));"


Pete
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now