Friends, I can't seem to get the syntax right on this SQL statement. I've tried various combinations of #, & and " around the where line but can't get it to run. I'm trying to insert records into a table using a start date and end date parameters from a form. Also I get nothing in the immediate window when I type ?startdate or ?enddate or ?strSQLCredit.
Dim strSQLCredit As String
Dim StartDate As Date
Dim EndDate As Date
StartDate = Me.Start_Date
EndDate = Me.End_Date
strSQLCredit = "INSERT INTO tblInterCoTemp ( Account, Credit, Line_Descripton, Invoice ) " & vbCrLf & _
"SELECT Manual_Invoice_Detail.Account, ([Qty]*[Price]) AS Credit, [Manual_Invoice_Detail]![Invoice] & "" "" & [Manual_Invoice_Detail]![Description] & "" ("" & [Qty] & "")"" AS [Line Description], Manual_Invoice_Detail.Invoice " & vbCrLf & _
"FROM Manual_Invoice_Header INNER JOIN Manual_Invoice_Detail ON Manual_Invoice_Header.Invoice = Manual_Invoice_Detail.Invoice " & vbCrLf & _
"WHERE (((Manual_Invoice_Detail.[Account])<>0) AND ((Manual_Invoice_Header.[Invoice Date]) Between #StartDate# And #EndDate# AND ((CustomerGroup([Cust]))=""CNF""));"
Doyce
Posted by: Duane Hookom <duanehookom@hotmail.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (6) |
Tidak ada komentar:
Posting Komentar