Filtering subforms is going to be the death of me lol. I'm sure there is something really simple I'm missing or overlooking, but I need some help. Here is my problem:
My Database Info:
I have a main form that is unbound called "frmOpenOrders"
I have 2 subforms in it, Subform1 is called "frmOpenOrdersSubform" and is in datasheet view
Subform2 is called "frmProductOrdersSubform" and is also in datasheet view
So when I open the main form I have a list of all the "open" orders in subform1 for orders that have just been placed or haven't shipped yet. One of the fields in the subform1 I have is titled Products, it says "View" in each record and I want to make it a hyperlink basically (not an actual hyperlink but I have it set to be displayed as one) so when you click on "View" on a particular record, I want it to filter the subform2 which will show just the products that were ordered related to the record (order #) you click on. I have tried what seems like a gazillion combinations of things and just cant figure it out. The field that both of these subforms (and their queries) are linked to is called "OrderID". I've tried:
Code:
Private Sub txtProducts_Click()
[Forms]![frmOpenOrders]![frmProductOrderDetailsSubform].[Form].Filter = "[OrderID] = " & Me.OrderID
[Forms]![frmOpenOrders]![frmProductOrderDetailsSubform].[Form].FilterOn = True
End Sub
I've tried other combinations on the filter = line such as
Code:
"[OrderID] = '" & Me.OrderID & "'"
All to no avail. I have a feeling its going to be something simple that I overlooked, but was hoping someone could tell me what I'm doing wrong? Currently with the above code, it shows at the bottom of the subform2 that it is "filtered" but it's not showing any records, it's just blank. I'm not sure if I need to do unbound textboxes on the main form and/or subforms to reference everything to link them together or if I can use something similar to what I've posted? and FYI, I'm still pretty new to access, vba and more complicated programming, so I'm trying my best to learn what I can, so please be patient with me if I don't understand something.
Thank you!
Kip