Hi, I am trying to use sql "order by" in vba. I get a syntax error. Can anyone help?
strWhere = strWhere & " ORDER BY [RADue] ". Thanks for any help!!
Code section:
Select Case Me.RptType
Case 1
'For Case Ovrdue Rpts in dialogue Box, find all dates for RADue <31 days overdue from today, > 30 days and'
'all null due dates'
Select Case Me.OvrDue
Case 1
'StrWhere = strWhere + "SQL Statement today's date & _ (line continuation)'
strWhere = strWhere & " AND [RADue] >= (Date()-30)" & _
"AND [RADue]< Date()" & _
"AND [RAComp]Is Null "
Case 2
strWhere = strWhere & " AND [RADue] < (Date()-30)" & _
" AND [RAComp]Is Null "
Case 3
strWhere = strWhere & " AND [RADue] Is Null" & _
" AND [RAComp]Is Null "
End Select
strWhere = strWhere & " ORDER BY [RADue]
strWhere = strWhere & " ORDER BY [RADue] ". Thanks for any help!!
Code section:
Select Case Me.RptType
Case 1
'For Case Ovrdue Rpts in dialogue Box, find all dates for RADue <31 days overdue from today, > 30 days and'
'all null due dates'
Select Case Me.OvrDue
Case 1
'StrWhere = strWhere + "SQL Statement today's date & _ (line continuation)'
strWhere = strWhere & " AND [RADue] >= (Date()-30)" & _
"AND [RADue]< Date()" & _
"AND [RAComp]Is Null "
Case 2
strWhere = strWhere & " AND [RADue] < (Date()-30)" & _
" AND [RAComp]Is Null "
Case 3
strWhere = strWhere & " AND [RADue] Is Null" & _
" AND [RAComp]Is Null "
End Select
strWhere = strWhere & " ORDER BY [RADue]