D
Don
I have a form with a subform. In the form, I have a select query as follows:
SELECT tblOrders.OrderID, tblOrders.CustomerId, tblCustomers.CompanyName
FROM tblCustomers INNER JOIN tblOrders ON tblCustomers.CustomerID =
tblOrders.CustomerId
ORDER BY tblOrders.OrderID;
In the subform (SubfrmOrderLines) with the following query:
SELECT tblPictures.Style, tblPictures.FilePath, tblPictures.FileName,
qryOrderLinesWPics.OrderID, qryOrderLinesWPics.LineID,
qryOrderLinesWPics.FinishItemID, qryOrderLinesWPics.QtyOrderd,
qryOrderLinesWPics.QtyShipped, qryOrderLinesWPics.ProducedInFactory,
qryOrderLinesWPics.ShpFactory, qryOrderLinesWPics.Status,
qryOrderLinesWPics.Month, qryOrderLinesWPics.RequestDate,
[QtyOrderd]<>[QtyShipped] AS ShowIf
FROM qryOrderLinesWPics INNER JOIN tblPictures ON qryOrderLinesWPics.Shoe =
tblPictures.Style
ORDER BY qryOrderLinesWPics.RequestDate;
The OrderID field is the Child - Master linked field.
What I am trying to do is create filter option via an Option Group. I cannot
seem to get the filter to work as I guess I do not know the correct way to
identify the subform's field to insert a filter in it's query. The following
is what I have:
Private Sub FilterOptions_AfterUpdate()
' Apply or remove the filter for the option the user chose.
If FilterOptions = 1 Then
Me.Filter = "qryOrderLinesWithPics.ShowIf = '-1'"
Me.FilterOn = True 'Apply filter.
If FilterOptions = 2 Then
Me.Filter = "qryOrderLinesWithPics.ShowIf = '0'"
Me.FilterOn = True 'Apply filter.
Else
Me.FilterOn = False 'Remove filter.
End If
End If
End Sub
In the Sub form, the query returns a value in the ShowIf field of -1 for
each Line Item of pending orders and 0 for each Line Item if the order's Line
Item is complete. If I could get the code to work there will be a second
problem.
If I filter the records of -1, all of the forms records OrderID, CustomerID
and CustomerName show up for completed orders but in the subform of course,
there are no records. So my second question is how can I skip those records
in the form when I activate the filter to begin with?
SELECT tblOrders.OrderID, tblOrders.CustomerId, tblCustomers.CompanyName
FROM tblCustomers INNER JOIN tblOrders ON tblCustomers.CustomerID =
tblOrders.CustomerId
ORDER BY tblOrders.OrderID;
In the subform (SubfrmOrderLines) with the following query:
SELECT tblPictures.Style, tblPictures.FilePath, tblPictures.FileName,
qryOrderLinesWPics.OrderID, qryOrderLinesWPics.LineID,
qryOrderLinesWPics.FinishItemID, qryOrderLinesWPics.QtyOrderd,
qryOrderLinesWPics.QtyShipped, qryOrderLinesWPics.ProducedInFactory,
qryOrderLinesWPics.ShpFactory, qryOrderLinesWPics.Status,
qryOrderLinesWPics.Month, qryOrderLinesWPics.RequestDate,
[QtyOrderd]<>[QtyShipped] AS ShowIf
FROM qryOrderLinesWPics INNER JOIN tblPictures ON qryOrderLinesWPics.Shoe =
tblPictures.Style
ORDER BY qryOrderLinesWPics.RequestDate;
The OrderID field is the Child - Master linked field.
What I am trying to do is create filter option via an Option Group. I cannot
seem to get the filter to work as I guess I do not know the correct way to
identify the subform's field to insert a filter in it's query. The following
is what I have:
Private Sub FilterOptions_AfterUpdate()
' Apply or remove the filter for the option the user chose.
If FilterOptions = 1 Then
Me.Filter = "qryOrderLinesWithPics.ShowIf = '-1'"
Me.FilterOn = True 'Apply filter.
If FilterOptions = 2 Then
Me.Filter = "qryOrderLinesWithPics.ShowIf = '0'"
Me.FilterOn = True 'Apply filter.
Else
Me.FilterOn = False 'Remove filter.
End If
End If
End Sub
In the Sub form, the query returns a value in the ShowIf field of -1 for
each Line Item of pending orders and 0 for each Line Item if the order's Line
Item is complete. If I could get the code to work there will be a second
problem.
If I filter the records of -1, all of the forms records OrderID, CustomerID
and CustomerName show up for completed orders but in the subform of course,
there are no records. So my second question is how can I skip those records
in the form when I activate the filter to begin with?