icemonster
Registered User.
- Local time
- Yesterday, 18:06
- Joined
- Jan 30, 2010
- Messages
- 502

can anyone point out what's wrong with my code? it's supposed to filter the enddate of a record from a unbound date field.
Code:
Function setRateList()
'set starting sql statement
strStartSql = "SELECT tblCareGiverCompensation.CAREGIVERCOMPID, tblCareGiverCompensation.COMPRATE, " _
& "tblCareGiverCompensation.COMPDATEADDED, tblCareGiverCompensation.COMPENDDATE, " _
& "tblCareGiverCompensation.COMPEMPLOYEEID, tblCareGiverCompensation.COMPCLIENTID, " _
& "tblCareGiverCompensation.COMPSERVICETYPE, tblCareGiverCompensation.COMPRATETTYPE, " _
& "tblCareGiverCompensation.COMPCOMMENT FROM tblCareGiverCompensation "
If Me.cboEmployee > 0 Then
lngEmployeeID2 = Me.cboEmployee
'determine if there is any existing value in the "strwheresql" variable
If strWhereSql = "" Then
strWhereSql = "Where tblCareGiverCompensation.COMPEMPLOYEEID = " & lngEmployeeID2 & " "
Else
strWhereSql = strWhereSql & "And tblCareGiverCompensation.COMPEMPLOYEEID = " & lngEmployeeID2 & " "
End If
End If
'check for values entered for start and ending date parameters
If Not IsNull(Me.txtEndDate) Then
'read the dates selected in the variables
dtStartDate2 = Me.txtStartDate
If strWhereSql = "" Then
strWhereSql = "WHERE tblCareGiverCompensation.COMPENDDATE > #" & dtStartDate2 & "# "
Else
strWhereSql = strWhereSql & "AND tblCareGiverCompensation.COMPENDDATE > #" & dtStartDate2 & "# "
End If
End If
strSortOrderSql = " ORDER BY tblCareGiverCompensation.COMPDATEADDED DESC;"
strSql2 = strStartSql & strWhereSql & strSortOrderSql
With Me.txtRate
.RowSource = strSql2
.Value = Null
End With
End Function