A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Click a subform field to open relevant form



 
 
Thread Tools Display Modes
  #1  
Old May 28th, 2010, 02:38 AM posted to microsoft.public.access.forms
CDIT
external usenet poster
 
Posts: 2
Default 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  
Old May 28th, 2010, 02:45 AM posted to microsoft.public.access.forms
Lord Kelvan
external usenet poster
 
Posts: 637
Default 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  
Old May 28th, 2010, 03:16 PM posted to microsoft.public.access.forms
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default 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  
Old May 28th, 2010, 04:10 PM posted to microsoft.public.access.forms
CDIT
external usenet poster
 
Posts: 2
Default 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  
Old May 30th, 2010, 10:09 PM posted to microsoft.public.access.forms
Lord Kelvan
external usenet poster
 
Posts: 637
Default 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

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.