Ok this is driving me nuts on my form I have a field called txt.FRMDATE Where I am trying to enter a date and run this code however every time I enter the date I get the famous Enter Parameter Value then if I enter the date again it works fine. I know I am missing some little thing if you see it please let me know.
Code:
Dim strFRMDATE As String
Dim strTEST As String
Dim strTEST1 As String
Dim strTEST2 As String
strFRMDATE = "#" & Me.txtFRMDATE.Value & "#"
strTEST = "12/4/2005"
strTEST1 = "11/27/2005"
strTEST2 = "11/20/2005"
"SELECT DATA.ISBN, DATA.CYP_UNITS_SOLD AS [" & strTEST & "] " & _
", DATA_1.CYP_UNITS_SOLD AS [" & strTEST1 & "]" & _
", DATA_2.CYP_UNITS_SOLD AS [" & strTEST2 & "] " & _
"FROM ((DATA LEFT JOIN DATA AS DATA_1 ON DATA.ISBN=DATA_1.ISBN) " & _
"LEFT JOIN DATA AS DATA_2 ON DATA.ISBN=DATA_2.ISBN)" & _
"WHERE ((DATA.WEEKNO)=DATEPART('ww',[" & strFRMDATE & "])) " & _
"AND ((DATA_1.WEEKNO)=DATEPART('ww',[" & strFRMDATE & "])-1) " & _
"AND ((DATA_2.WEEKNO)=DATEPART('ww',[" & strFRMDATE & "])-2) " & _
"AND DATA.CMT_CODE='AMZ' " & _
"AND DATA_1.CMT_CODE='AMZ' " & _
"AND DATA_2.CMT_CODE='AMZ'" & _
"AND ((YEAR(DATA.WEEK))=YEAR([" & strFRMDATE & "]))" & _
"AND ((YEAR(DATA_1.WEEK))=YEAR([" & strFRMDATE & "]))" & _
"AND ((YEAR(DATA_2.WEEK))=YEAR([" & strFRMDATE & "]))" & _
";"