With earlier help from this group (thanks Ben!) I've ended up with this
OnLoad code for my popup form:
Private Sub Form_Load()
If IsNull([Forms]![frmCustomerOrde rs]![MarketPlaceID]) = True Then
Me.RecordSource = "SELECT [tempOrders].* FROM [tempOrders] WHERE
[tempOrders]!OrderID = Null"
Else
Me.RecordSource = "SELECT [tempOrders].* FROM [tempOrders] WHERE
[tempOrders]![MarketPlaceID]=[Forms]![frmCustomerOrde rs]![MarketPlaceID]"
End If
End Sub
So, if MarketPlaceID is null on the parent form, the popup form displays
records where there is no OrderID, otherwise it displays records where the
MarketPlaceID matches.
I need to tweak it because there are some instances where the MarketPlaceID
exists on the parent form but may not match any of the MarketPlaceID in the
tempOrders table. I've looked at unmatched queries but that only seems to
cater for unmatches netween to tables and not a table and a form value. I've
briefly looked at WHERE NOT EXISTS and wonder if that is the way forward? If
so I'm a bit sketchy as to how to insert it into the code above?
Thanks
Alan
OnLoad code for my popup form:
Private Sub Form_Load()
If IsNull([Forms]![frmCustomerOrde rs]![MarketPlaceID]) = True Then
Me.RecordSource = "SELECT [tempOrders].* FROM [tempOrders] WHERE
[tempOrders]!OrderID = Null"
Else
Me.RecordSource = "SELECT [tempOrders].* FROM [tempOrders] WHERE
[tempOrders]![MarketPlaceID]=[Forms]![frmCustomerOrde rs]![MarketPlaceID]"
End If
End Sub
So, if MarketPlaceID is null on the parent form, the popup form displays
records where there is no OrderID, otherwise it displays records where the
MarketPlaceID matches.
I need to tweak it because there are some instances where the MarketPlaceID
exists on the parent form but may not match any of the MarketPlaceID in the
tempOrders table. I've looked at unmatched queries but that only seems to
cater for unmatches netween to tables and not a table and a form value. I've
briefly looked at WHERE NOT EXISTS and wonder if that is the way forward? If
so I'm a bit sketchy as to how to insert it into the code above?
Thanks
Alan
Comment