PC Review


Reply
Thread Tools Rate Thread

Click a subform field to open relevant form

 
 
CDIT
Guest
Posts: n/a
 
      28th May 2010
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.
 
Reply With Quote
 
 
 
 
Lord Kelvan
Guest
Posts: n/a
 
      28th May 2010
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
 
Reply With Quote
 
Tom van Stiphout
Guest
Posts: n/a
 
      28th May 2010
On Thu, 27 May 2010 18:45:35 -0700 (PDT), Lord Kelvan
<(E-Mail Removed)> 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

 
Reply With Quote
 
CDIT
Guest
Posts: n/a
 
      28th May 2010
On May 28, 3:16*pm, Tom van Stiphout <tom7744.no.s...@cox.net> wrote:
> On Thu, 27 May 2010 18:45:35 -0700 (PDT), Lord Kelvan
>
> <the_idd...@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 (

Any other ideas and contributions will be greatly appreciated.

Many thanks again.
 
Reply With Quote
 
Lord Kelvan
Guest
Posts: n/a
 
      30th May 2010
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
click on subform, then click on button to open form to rcd in subform charlie via AccessMonster.com Microsoft Access Form Coding 0 8th Aug 2006 07:38 PM
click row on subform, then click button to open form to rcd in subform charlie via AccessMonster.com Microsoft Access Forms 1 8th Aug 2006 07:37 PM
click row on subform, then click button to open form to rcd in subform charlie via AccessMonster.com Microsoft Access Forms 0 8th Aug 2006 07:32 PM
Open 2nd form after click in record in Subform =?Utf-8?B?YW4=?= Microsoft Access 2 10th Jul 2005 06:16 PM
Form to open subform on field click =?Utf-8?B?Sm95Y2U=?= Microsoft Access 0 3rd May 2005 01:51 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:35 AM.