Question : syntax error in FROM clause

Private Sub Calendar1_Click()
Text1.Text = Calendar1.Value
End Sub

Private Sub Calendar2_Click()
Text2.Text = Calendar2.Value
End Sub

  Private Sub Command1_Click()
    Adodc1.RecordSource = "SELECT qryVAT.InvoiceNo, qryVAT.SumOfAmount, qryVAT.exVAT, [exVAT]*0.12 AS VAT, qryVAT.DateDelivered From qryVAT WHERE [(((qryVAT.DateDelivered) Between #" & Text1.Text & "# And #" & Text2.Text & "#));"

   Set DataGrid1.DataSource = Adodc1
   Call Command2_Click
   
   
    Set rptVAT.DataSource = Adodc1
       With rptVAT
       
        .Sections("section1").Controls.Item("text1").DataField = "InvoiceNo"
        .Sections("section1").Controls.Item("text2").DataField = "SumofAmount"
        .Sections("section1").Controls.Item("text3").DataField = "exVAT"
        .Sections("section1").Controls.Item("text4").DataField = "VAT"
   
       
     
          .Sections("section5").Controls.Item("function1").DataField = "SumofAmount"
          .Sections("section5").Controls.Item("function2").DataField = "exVAT"
          .Sections("section5").Controls.Item("function3").DataField = "VAT"
             
    End With
   
 rptVAT.Show
 
End Sub
   



Private Sub Command2_Click()
Adodc1.Refresh
End Sub

Private Sub Form_Load()
 
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\ROAInvent\database\dbInvent.mdb;Persist Security Info=False"
Adodc1.CursorLocation = adUseClient

Text1.Text = Date
Text2.Text = Date


text4.AddItem "For Approval"
text4.AddItem "Issued"
adoDepartment.Recordset.MoveFirst
While Not adoDepartment.Recordset.EOF
Text3.AddItem adoDepartment.Recordset.Fields(0)
adoDepartment.Recordset.MoveNext
Wend

End Sub




here is the error



runtime error '-2147217900 (80040e14)
syntax error in FROM clause

Answer : syntax error in FROM clause

Your where clause has a [ in it. As far as I can see this should not be there.

regards
Marco

Random Solutions  
 
programming4us programming4us