carlleese24
Board Regular
- Joined
- Mar 15, 2005
- Messages
- 108
Hi all
Hope someone can help me with the below as I will be very grateful if they did
The below is an sql code I run on VBA in excel and it keeps giving me a syntax error missing operator but unsure where to put this.
What I am trying to do is pull data between 04/12/2022 to 10/12/2022 only for JDA and JDA2
Thank you in advance
Hope someone can help me with the below as I will be very grateful if they did
The below is an sql code I run on VBA in excel and it keeps giving me a syntax error missing operator but unsure where to put this.
What I am trying to do is pull data between 04/12/2022 to 10/12/2022 only for JDA and JDA2
VBA Code:
sSQLSting = "SELECT *"
sSQLSting = sSQLSting & "FROM [" & table & "]" & ""
sSQLSting = sSQLSting & "WHERE ((" & field2 & ")= '" & (Criteria3) & "' AND"
sSQLSting = sSQLSting & "[" & field & "]Between # " & Format(Criteria, "yyyy-mm-dd") & "# AND #" & Format(Criteria2, "yyyy-mm-dd") & " OR"
sSQLSting = sSQLSting & "[" & field2 & "]= '" & (Criteria3) & "' AND"
sSQLSting = sSQLSting & "[" & field & "]Between # " & Format(Criteria, "yyyy-mm-dd") & "# AND #" & Format(Criteria2, "yyyy-mm-dd") & "#)"
Thank you in advance