Prev: Windows 7 presses button
Next: Embed Excel with form
From: CDIT on 27 May 2010 21:38 Hi, this is my first post :o) l've created a main menu form in Access 2007 called frmSwitchboard and embedded in that is a subform called "subfrmSwitchboard" that contains all customer orders of a certain type (Active, Paid, Unpaid). Each order has an Autonumber field called ID as it's primary key. Linked to the ID field on the subform is a macro that should open up "frmOrders" with the relevant order number's record shown when you click the relevant ID number on the subform. If I open up the subform on its own in datasheet view and click an ID field then the relevant order form appears, great. However, if I do this within the subform being present on the main form (frmSwitchboard) it doesnt, I get an input box appearing with the WHERE clause from my macro showing: Forms!subfrmswitchboard!ID The WHERE clause in the macro is: [ID]=[Forms]![subfrmswitchboard]! [ID] If I type in the order ID then the form appears but I want this nuisance not to be the case. Where have I gone wrong? Many thanks in advance.
From: Lord Kelvan on 27 May 2010 21:45 You need to reference the subform through the mainform because the subform is not "open" as per say in the [forms] collection Use the condition [ID]=[Forms]![ frmSwitchboard]![subfrmswitchboard]![ID] If you open this subform as a normal form as well then tell me and you need to do something more complicated as this condition will not work in that case. Regards Kelvan
From: Tom van Stiphout on 28 May 2010 10:16 On Thu, 27 May 2010 18:45:35 -0700 (PDT), Lord Kelvan <the_iddiot(a)hotmail.com> wrote: Actually that should be: [ID]=[Forms]![ frmSwitchboard]![subfrmswitchboard].Form![ID] The way I think about this syntax is that [Forms]![ frmSwitchboard]![subfrmswitchboard] accesses the subform control, so you could inspect its properties (e.g. Left, SourceObject, etc). ..Form makes you step into the (sub)form and now you can access the controls in that form. -Tom. Microsoft Access MVP >You need to reference the subform through the mainform because the >subform is not "open" as per say in the [forms] collection > >Use the condition > >[ID]=[Forms]![ frmSwitchboard]![subfrmswitchboard]![ID] > >If you open this subform as a normal form as well then tell me and you >need to do something more complicated as this condition will not work >in that case. > >Regards >Kelvan
From: CDIT on 28 May 2010 11:10 On May 28, 3:16 pm, Tom van Stiphout <tom7744.no.s...(a)cox.net> wrote: > On Thu, 27 May 2010 18:45:35 -0700 (PDT), Lord Kelvan > > <the_idd...(a)hotmail.com> wrote: > > Actually that should be: > [ID]=[Forms]![ frmSwitchboard]![subfrmswitchboard].Form![ID] > > The way I think about this syntax is that [Forms]![ > frmSwitchboard]![subfrmswitchboard] accesses the subform control, so > you could inspect its properties (e.g. Left, SourceObject, etc). > .Form makes you step into the (sub)form and now you can access the > controls in that form. > > -Tom. > Microsoft Access MVP > > > > >You need to reference the subform through the mainform because the > >subform is not "open" as per say in the [forms] collection > > >Use the condition > > >[ID]=[Forms]![ frmSwitchboard]![subfrmswitchboard]![ID] > > >If you open this subform as a normal form as well then tell me and you > >need to do something more complicated as this condition will not work > >in that case. > > >Regards > >Kelvan Hi and thanks very much for the prompt responses. Unfortunately I have tried both and the input box still appears :o( Any other ideas and contributions will be greatly appreciated. Many thanks again.
From: Lord Kelvan on 30 May 2010 17:09 Interesting my code works fine for me I dont need to use .form![id] though it doesnt matter it did not work for him. BWAHAHA My fault I am so sorry and well-done to Tom van Stiphout FOR THE COPY PASTE OF MY MISTAKE =P [ID]=[Forms]![ frmSwitchboard]![subfrmswitchboard]![ID] There is a space there youll see it if you look close Try this [ID]=[Forms]![frmSwitchboard]![subfrmswitchboard]![ID] Regards Kelvan
|
Pages: 1 Prev: Windows 7 presses button Next: Embed Excel with form |