Sql Query comparison

m kappler

Registered User.
Local time
Today, 14:32
Joined
Mar 14, 2005
Messages
13
I have the following Sql statement which will append to a table called Times. Before it does I want to test that the value of Log.Field2 after SELECT has a greater (date) value than a field called Start in another table called DateChanges.

DoCmd.RunSQL "INSERT INTO Times ( Tel, DateLog, TimeLog, Site ) SELECT Log.Field1, Log.Field2, Log.Field3, Log.Filed4 FROM Log" ;”

Any help on this is greatly appreciated.
 
m,

Code:
DoCmd.RunSQL "INSERT INTO Times ( Tel, DateLog, TimeLog, Site ) " & _
             "SELECT A.Field1, A.Field2, A.Field3, A.Filed4 " & _
             "FROM   Log As A Left Join DateChanges As B On " & _
             "       A.Field1 = B.Field1 " & _
             "Where  A.Field2 > B.Start"

Wayne
 

Users who are viewing this thread

Back
Top Bottom