If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Click a subform field to open relevant form
Hi, this is my first post )
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 doesn’t, 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. |
#2
|
|||
|
|||
Click a subform field to open relevant form
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 |
#3
|
|||
|
|||
Click a subform field to open relevant form
On Thu, 27 May 2010 18:45:35 -0700 (PDT), Lord Kelvan
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 |
#4
|
|||
|
|||
Click a subform field to open relevant form
On May 28, 3:16*pm, Tom van Stiphout wrote:
On Thu, 27 May 2010 18:45:35 -0700 (PDT), Lord Kelvan 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 ( Any other ideas and contributions will be greatly appreciated. Many thanks again. |
#5
|
|||
|
|||
Click a subform field to open relevant form
Interesting my code works fine for me I don’t need to use .form![id]
though it doesn’t 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 you’ll see it if you look close Try this [ID]=[Forms]![frmSwitchboard]![subfrmswitchboard]![ID] Regards Kelvan |
Thread Tools | |
Display Modes | |
|
|