The line that say's: SQLStmt = SQLStmt & " (Table1.Terr = " & Me.Text59 & " ) " sets a filter to whatever terr(itory) number I input into Me.Text59.<br>
What I would like to do now is also add a Sort on DateField to the same SQLStmt.<br>
Final outcome would be a database displaying all, example Terr(itory) 8 sorted by DateField.<br>
Is this possible or am I asking too much of SQL? Thanks Ray<br>
<br>
Sub Refreshdata()<br>
Dim SQLStmt As String<br>
SQLStmt = "SELECT * FROM Table1 WHERE"<br>
If Me.Text59 <> "" Then<br>
SQLStmt = SQLStmt & " (Table1.Terr = " & Me.Text59 & " ) "<br>
End If<br>
MsgBox " Me.text59 (a Number Field) = number " & Me.Text59<br>
If Right(SQLStmt,5)<>"WHERE" Then Me.RecordSource = SQLStmt<br>
End Sub<br>
<br>
<br>
<br>
What I would like to do now is also add a Sort on DateField to the same SQLStmt.<br>
Final outcome would be a database displaying all, example Terr(itory) 8 sorted by DateField.<br>
Is this possible or am I asking too much of SQL? Thanks Ray<br>
<br>
Sub Refreshdata()<br>
Dim SQLStmt As String<br>
SQLStmt = "SELECT * FROM Table1 WHERE"<br>
If Me.Text59 <> "" Then<br>
SQLStmt = SQLStmt & " (Table1.Terr = " & Me.Text59 & " ) "<br>
End If<br>
MsgBox " Me.text59 (a Number Field) = number " & Me.Text59<br>
If Right(SQLStmt,5)<>"WHERE" Then Me.RecordSource = SQLStmt<br>
End Sub<br>
<br>
<br>
<br>