T
Toni Miletic
Hi all,
I'm using Access 2000 SR1
Could you please help me with this code. I'm trying to run SQL query from VBA:
VBA code:
strSQL = "SELECT tblUzorak.IDVrsta, Avg([tblUzorak]![PEN14647_6h]) AS
30A_PEN14647_6h, Avg([tblUzorak]![PEN14647_1d]) AS 30A_PEN14647_1d,
Format(Avg([tblUzorak]![pastaENpoc]),""Long Time"",2,2) AS 30A_pastaENpoc,
Avg([tblUzorak]![CA]) AS 30A_CA, 1/Avg([tblUzorak]![C12A7_CA]) AS
30A_CA_C12A7, Avg([tblUzorak]![SiO2]) AS 30A_SiO2, Avg([tblUzorak]![FeO]) AS
30A_FeO, Avg([tblUzorak]![AC]) AS 30A_AC, StDev([tblUzorak]![PEN14647_6h]) AS
30ST_PEN14647_6h, StDev([tblUzorak]![PEN14647_1d]) AS 30ST_PEN14647_1d,
Format(StDev([tblUzorak]![pastaENpoc]),""Long Time"",2,2) AS 30ST_pastaENpoc,
StDev([tblUzorak]![CA]) AS 30ST_CA, 1/StDev([tblUzorak]![C12A7_CA]) AS
30ST_CA_C12A7, StDev([tblUzorak]![SiO2]) AS 30ST_SiO2,
StDev([tblUzorak]![FeO]) AS 30ST_FeO, StDev([tblUzorak]![AC]) AS 30ST_AC " & _
"FROM tblVrsta INNER JOIN tblUzorak ON tblVrsta.ID =
tblUzorak.IDVrsta " & _
"WHERE ((tblVrsta.vrsta) Like '" &
[Forms]![frmStatsitikaOpreme]![VrstaCementa] & "') AND ((tblUzorak.datum)
BETWEEN #" & startdate & "# AND #" & enddate & "# ) AND ((tblUzorak.proces)
Like '" & [Forms]![frmStatsitikaOpreme]![proces] & "') " & _
"GROUP BY tblUzorak.IDVrsta "
Set rstRS = dbsDB.OpenRecordset(strSQL, dbOpenDynaset)
I got this error message after running:
Run-time error '3075':
Syntax error in date in query expresion '((tblVrsta.vrsta) Like 'Product1')
AND ((tblUzorak.datum) BETWEEN #11.10.2009# AND #10.11.2009) AND
((tblUzorak.preces) like 'process1')'.
Any help would be great. Thanks in advance.
Toni
I'm using Access 2000 SR1
Could you please help me with this code. I'm trying to run SQL query from VBA:
VBA code:
strSQL = "SELECT tblUzorak.IDVrsta, Avg([tblUzorak]![PEN14647_6h]) AS
30A_PEN14647_6h, Avg([tblUzorak]![PEN14647_1d]) AS 30A_PEN14647_1d,
Format(Avg([tblUzorak]![pastaENpoc]),""Long Time"",2,2) AS 30A_pastaENpoc,
Avg([tblUzorak]![CA]) AS 30A_CA, 1/Avg([tblUzorak]![C12A7_CA]) AS
30A_CA_C12A7, Avg([tblUzorak]![SiO2]) AS 30A_SiO2, Avg([tblUzorak]![FeO]) AS
30A_FeO, Avg([tblUzorak]![AC]) AS 30A_AC, StDev([tblUzorak]![PEN14647_6h]) AS
30ST_PEN14647_6h, StDev([tblUzorak]![PEN14647_1d]) AS 30ST_PEN14647_1d,
Format(StDev([tblUzorak]![pastaENpoc]),""Long Time"",2,2) AS 30ST_pastaENpoc,
StDev([tblUzorak]![CA]) AS 30ST_CA, 1/StDev([tblUzorak]![C12A7_CA]) AS
30ST_CA_C12A7, StDev([tblUzorak]![SiO2]) AS 30ST_SiO2,
StDev([tblUzorak]![FeO]) AS 30ST_FeO, StDev([tblUzorak]![AC]) AS 30ST_AC " & _
"FROM tblVrsta INNER JOIN tblUzorak ON tblVrsta.ID =
tblUzorak.IDVrsta " & _
"WHERE ((tblVrsta.vrsta) Like '" &
[Forms]![frmStatsitikaOpreme]![VrstaCementa] & "') AND ((tblUzorak.datum)
BETWEEN #" & startdate & "# AND #" & enddate & "# ) AND ((tblUzorak.proces)
Like '" & [Forms]![frmStatsitikaOpreme]![proces] & "') " & _
"GROUP BY tblUzorak.IDVrsta "
Set rstRS = dbsDB.OpenRecordset(strSQL, dbOpenDynaset)
I got this error message after running:
Run-time error '3075':
Syntax error in date in query expresion '((tblVrsta.vrsta) Like 'Product1')
AND ((tblUzorak.datum) BETWEEN #11.10.2009# AND #10.11.2009) AND
((tblUzorak.preces) like 'process1')'.
Any help would be great. Thanks in advance.
Toni