G
Guest
I have used Allen's list box example before and it worked perfectly... now
I have the following as the row source for my list box. Id is a number TID
is text
SELECT TerritoryNumbers.ID, TerritoryNumbers.TID, tblArea.AreaName,
TerritoryNumbers.DateCheckedIn
FROM TerritoryNumbers INNER JOIN tblArea ON TerritoryNumbers.Area =
tblArea.AreaID
ORDER BY TerritoryNumbers.DateCheckedIn;
I cannot get the following code to work on the preview button and I don't
know why
I get a an enter perameter box [TerritoryNumbers].[ID] everything else in
the code is original
'strDelim = """" 'If your field is a TEXT type, remove the single-quote
on this line
strDoc = "rptViewReports"
'Loop through the ItemsSelected in the list box.
With Me.lstTerritories
For Each varItem In .ItemsSelected
If Not IsNull(varItem) Then
'Build up the filter from the bound column (hidden).
strWhere = strWhere & strDelim & .ItemData(varItem) &
strDelim & ","
'Build up the description from the TEXT in the visible
column. See note 2.
strDescrip = strDescrip & """" & .Column(1, varItem) & """, "
End If
Next
End With
'Remove trailing comma. Add field name, IN operator, and brackets.
lngLen = Len(strWhere) - 1
If lngLen > 0 Then
strWhere = "[TerritoryNumbers].[ID] IN (" & Left$(strWhere, lngLen)
& ")"
lngLen = Len(strDescrip) - 2
If lngLen > 0 Then
strDescrip = "TerritoryNumbers: " & Left$(strDescrip, lngLen)
End If
End If
Can someone tell me what is wrong?
Thanks!
I have the following as the row source for my list box. Id is a number TID
is text
SELECT TerritoryNumbers.ID, TerritoryNumbers.TID, tblArea.AreaName,
TerritoryNumbers.DateCheckedIn
FROM TerritoryNumbers INNER JOIN tblArea ON TerritoryNumbers.Area =
tblArea.AreaID
ORDER BY TerritoryNumbers.DateCheckedIn;
I cannot get the following code to work on the preview button and I don't
know why
I get a an enter perameter box [TerritoryNumbers].[ID] everything else in
the code is original
'strDelim = """" 'If your field is a TEXT type, remove the single-quote
on this line
strDoc = "rptViewReports"
'Loop through the ItemsSelected in the list box.
With Me.lstTerritories
For Each varItem In .ItemsSelected
If Not IsNull(varItem) Then
'Build up the filter from the bound column (hidden).
strWhere = strWhere & strDelim & .ItemData(varItem) &
strDelim & ","
'Build up the description from the TEXT in the visible
column. See note 2.
strDescrip = strDescrip & """" & .Column(1, varItem) & """, "
End If
Next
End With
'Remove trailing comma. Add field name, IN operator, and brackets.
lngLen = Len(strWhere) - 1
If lngLen > 0 Then
strWhere = "[TerritoryNumbers].[ID] IN (" & Left$(strWhere, lngLen)
& ")"
lngLen = Len(strDescrip) - 2
If lngLen > 0 Then
strDescrip = "TerritoryNumbers: " & Left$(strDescrip, lngLen)
End If
End If
Can someone tell me what is wrong?
Thanks!