LarryDeLaruelle
Technical User
I am trying to create two queries in a module that will update a table when the database is opened. I created the queries to test them and then copied/pasted the SQL view into the module to create the SQL strings. However, when I move off the last line I get the above error; checking help says "Improper use of parentheses . . ."
Here is the code:
strSQL = "INSERT INTO tblOryxMaster ( ClientID, FullName, ServiceDate ) " _
strsql = strsql & "SELECT Client.ClientID, Client.FullName, Client.ServiceDate " _
strsql = strsql & "FROM Client LEFT JOIN tblOryxMaster ON Client.ClientID = tblOryxMaster.ClientID " _
strsql = strsql & "WHERE (((Client.ServiceDate)>=#1/1/2000#) AND " _
strsql = strsql & "((IIf([tblOryxMaster].[clientid]=[client].[clientid],1,0))=0)) ;"
strSQL = "UPDATE tblOryxMaster INNER JOIN ClientProgram " _
strSQL = strsql & "ON tblOryxMaster.ClientID = ClientProgram.ClientID " _
strsql = strsql & "SET tblOryxMaster.DischargeDate = [clientprogram].[dischargedate]" _
strsql = strsql & "WHERE (((tblOryxMaster.DischargeDate) Is Null) " _
strsql = strsql & "AND ((ClientProgram.EndDate)=[clientprogram].[dischargedate]));"
I'm sure the answer is obvious, but I've looked at this and counted parands for so long I've gotten a headache. TGIF.
Thanks for looking at this. [sig]<p>Larry De Laruelle<br><a href=mailto:larry1de@yahoo.com>larry1de@yahoo.com</a><br><a href= > </a><br> [/sig]
Here is the code:
strSQL = "INSERT INTO tblOryxMaster ( ClientID, FullName, ServiceDate ) " _
strsql = strsql & "SELECT Client.ClientID, Client.FullName, Client.ServiceDate " _
strsql = strsql & "FROM Client LEFT JOIN tblOryxMaster ON Client.ClientID = tblOryxMaster.ClientID " _
strsql = strsql & "WHERE (((Client.ServiceDate)>=#1/1/2000#) AND " _
strsql = strsql & "((IIf([tblOryxMaster].[clientid]=[client].[clientid],1,0))=0)) ;"
strSQL = "UPDATE tblOryxMaster INNER JOIN ClientProgram " _
strSQL = strsql & "ON tblOryxMaster.ClientID = ClientProgram.ClientID " _
strsql = strsql & "SET tblOryxMaster.DischargeDate = [clientprogram].[dischargedate]" _
strsql = strsql & "WHERE (((tblOryxMaster.DischargeDate) Is Null) " _
strsql = strsql & "AND ((ClientProgram.EndDate)=[clientprogram].[dischargedate]));"
I'm sure the answer is obvious, but I've looked at this and counted parands for so long I've gotten a headache. TGIF.
Thanks for looking at this. [sig]<p>Larry De Laruelle<br><a href=mailto:larry1de@yahoo.com>larry1de@yahoo.com</a><br><a href= > </a><br> [/sig]