Passing subform value to new form (1 Viewer)

Cantthinkofone

Registered User.
Local time
Yesterday, 16:46
Joined
May 2, 2018
Messages
19
I have a 2016 access db with a form which contains a subform. The parent form has a combobox to select which staff person I want to query/filter the data and show in the subform. This works great.

In the subform, I have an 'on dbl click' event on the order number to open an 'Order Details' form based on the order number I double clicked. This is the hiccup, when I use an OpenForm Macro with Where "[OrderNumber] =" & [OrderNumber], instead of passing the value, I get a parameter prompt message box to re-enter the order number I just clicked.

When I tried the same OpenForm Macro, removing the Where and replace with a Filter Name qry Order Details to filter on the chosen order number, I again get the parameter message box prompting to enter the order number.

I'm sure there is an easy, logical solution that I can't wrap my head around.

Thanks for reading my novella and any assistance is appreciated.
 

NauticalGent

Ignore List Poster Boy
Local time
Yesterday, 19:46
Joined
Apr 27, 2015
Messages
6,321
Try removing the brackets on [OrderNumer] and replace it with Me.OrderNumber.

I do not use macros so it may be something else, but give it a try. Every once in awhile I get lucky.
 

June7

AWF VIP
Local time
Yesterday, 15:46
Joined
Mar 9, 2014
Messages
5,466
Me. only works in VBA. You say you are using macro. However, your expression syntax is VBA. The brackets are not issue, in fact macro will add them.

In macro have to use full path reference to the control, like:

[OrderNumber]=Forms!mainform!subformcontainer!fieldname

I always name subform container different from the object it holds, like: ctrDetails.
 
Last edited:

Cantthinkofone

Registered User.
Local time
Yesterday, 16:46
Joined
May 2, 2018
Messages
19
hmm, I"ll have to research subform containers, that's a new term for me.
I have the parent {frm Work Queue}, with a subfrm sbfrmRequest, which contains a control OrderNumber.
so based on your example, I should reference the Where =
[OrderNumber]=Forms![frm Work Queue]![sbfrmRequest]![OrderNumber]

I'll give that a try, thanks
 

Cantthinkofone

Registered User.
Local time
Yesterday, 16:46
Joined
May 2, 2018
Messages
19
editing

whoop whoop it works it works!!!
It was a pesky . not !

Thanks for your help
 
Last edited:

Users who are viewing this thread

Top Bottom