The_Vicar75
Registered User.
- Local time
- Today, 07:40
- Joined
- Apr 22, 2008
- Messages
- 13
Hi,
This works fine in a query, but if I use it behind a commandbutton in VBA error 3067 occurs.
I tried spaces at begin & end of the strings, but it doesn't help much.
anyone?
thx,
V.
SQL:
Private Sub Vette_Test_Kopij_Tblmkqry()
Dim SQLstringTEST As String
DoCmd.SetWarnings False
SQLstringTEST = " SELECT tblOverview.NcNumber, tblOverview.IssueDate, tblOverview.NonConformity, tblOverview.lkpStatus, tblOverview.ClosingDate, tblOverview.Feedback, [forms].[frm_Afsluiting].[txt_begindatum] AS Begindatum, [forms].[frm_Afsluiting].[txt_einddatum] AS Einddatum INTO tbl_Vette Test " & _
" FROM tblOverview " & _
" WHERE (((tblOverview.IssueDate) Between ([forms].[frm_Afsluiting].[txt_begindatum] And [forms].[frm_Afsluiting].[txt_einddatum])) AND ((tblOverview.lkpStatus)='open' Or (tblOverview.lkpStatus)='follow-up') AND ((tblOverview.ClosingDate) Is Null)) " & _
" ORDER BY tblOverview.IssueDate; "
Debug.Print SQLstringTEST
DoCmd.RunSQL SQLstringTEST
DoCmd.SetWarnings True
End Sub
This works fine in a query, but if I use it behind a commandbutton in VBA error 3067 occurs.
I tried spaces at begin & end of the strings, but it doesn't help much.
anyone?
thx,
V.
SQL:
Private Sub Vette_Test_Kopij_Tblmkqry()
Dim SQLstringTEST As String
DoCmd.SetWarnings False
SQLstringTEST = " SELECT tblOverview.NcNumber, tblOverview.IssueDate, tblOverview.NonConformity, tblOverview.lkpStatus, tblOverview.ClosingDate, tblOverview.Feedback, [forms].[frm_Afsluiting].[txt_begindatum] AS Begindatum, [forms].[frm_Afsluiting].[txt_einddatum] AS Einddatum INTO tbl_Vette Test " & _
" FROM tblOverview " & _
" WHERE (((tblOverview.IssueDate) Between ([forms].[frm_Afsluiting].[txt_begindatum] And [forms].[frm_Afsluiting].[txt_einddatum])) AND ((tblOverview.lkpStatus)='open' Or (tblOverview.lkpStatus)='follow-up') AND ((tblOverview.ClosingDate) Is Null)) " & _
" ORDER BY tblOverview.IssueDate; "
Debug.Print SQLstringTEST
DoCmd.RunSQL SQLstringTEST
DoCmd.SetWarnings True
End Sub