yes , RequiredDate is not a primary key, however, a composite primary key
might help. i like to base my output on two keys, the RequiredDate and
OrderNo......RequiredDate being a Date type and OrderNo a Number type....now
this is what i have and can you lead me on to adding the other side of the
code to include OrderNo........i would think an AND somewhere....thanks
again....
On Error GoTo Err_Handler
Dim varItem As Variant 'Selected items
Dim strWhere As String 'String to use as WhereCondition
Dim strDescrip As String 'Description of WhereCondition
Dim lngLen As Long 'Length of string
Dim strDelim As String 'Delimiter for this field type.
Dim strDoc As String 'Name of report to open.
Dim strLabel As String
strDelim = "#" 'Delimiter appropriate to field type. See
note 1.
strDoc = "rptProduction"
'strLabel = "rptProductionLabel"
'Loop through the ItemsSelected in the list box.
With Me.sched
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 & ","
End If
Next
End With
lngLen = Len(strWhere) - 1
If lngLen > 0 Then
strWhere = "[RequiredDate] IN (" & Left$(strWhere, lngLen) & ")"
lngLen = Len(strDescrip) - 4
If lngLen > 0 Then
strDescrip = "Order No" & Left$(strDescrip, lngLen)
End If
End If
If CurrentProject.AllReports(strDoc).IsLoaded Then
DoCmd.close acReport, strDoc
End If
DoCmd.OpenReport strDoc, acViewPreview, WhereCondition:=strWhere,
OpenArgs:=strDescrip
You've probably figured this out by now, but here's the syntax I think you're
looking for:
[quoted text clipped - 35 lines]