Open Form Macro

Harry Taylor

Registered User.
Local time
Today, 04:14
Joined
Jul 10, 2012
Messages
90
I have a customer form [Heatersmaster]

In this form is a button to open [Phonebook]

[Phonebook] has a subform [PBSubform]
This shows contacts, some with account numbers, some without.

Where there is an account number I want to double click so it opens Heatersmaster on that account.


In [PBSubform] On Dbl Click I have a macro;

1725541012466.png

When I double click I get;

1725541042338.png


Where am I going wrong?
 
Thanks Gasman
I'm early days with VBA. I get what you mean, but could you spell it out a bit please, sorry.
 
I have a customer form [Heatersmaster]

In this form is a button to open [Phonebook]

[Phonebook] has a subform [PBSubform]
This shows contacts, some with account numbers, some without.

Where there is an account number I want to double click so it opens Heatersmaster on that account.


In [PBSubform] On Dbl Click I have a macro;

View attachment 115944
When I double click I get;

View attachment 115945

Where am I going wrong?
I don't use macros, but it appears to me that you are attempting to open the Heatersmaster form based upon some criteria from a different form (PBSubForm). If PBSubform is a sub-form of Heatersmaster form, then the Where Condition should be:

=[ACCOUNT]=Forms![Heatersmaster]![PBSubform]![ACCOUNT]
 
This doesnt work, but what about something like this;

DoCmd.OpenForm "Heatersmaster", _
WhereCondition:="Account=" & Me.Account
 
Cannot make it any easier than that TBH?

Try Forms!PhoneBook!PBSubform!Form!Account

I am assuming that the subformcontrol name is the same as the subformname, which tens to be the case if you drag and dro
 
This doesnt work, but what about something like this;

DoCmd.OpenForm "Heatersmaster", _
WhereCondition:="Account=" & Me.Account
Also, make sure the [ACCOUNT] field is included in the Heatersmaster form Record Source.
 
This doesnt work, but what about something like this;

DoCmd.OpenForm "Heatersmaster", _
WhereCondition:="Account=" & Me.Account
Not even sure you can use Me. in macros? :(
Try googling 'Open form access macro'
Your issue is the control is on the subform and you are not addressing it correctly.
 

Users who are viewing this thread

Back
Top Bottom