[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Using macros with navigation forms in Access 2010

Posted on 2014-03-05
7
Medium Priority
?
1,976 Views
Last Modified: 2014-03-09
Hi ,

I have a form called interventions which I have set when I double click the IID field it opens up the form Update Register for that Intervention, it is working using a macro and the where action is just open form Setup Register  and the where clause is [IID]=[Forms]![Interventions]![IID].

This all works well until I place the form within a navigation forms and then the double click stops working.

Any idea why? I have only just started using navigation forms and they seem to be a pretty neat way to go.

Any help appreciated.

Tricia
0
Comment
Question by:tmckeating
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 85
ID: 39909062
until I place the form within a navigation forms and then the double click stops working.
Generally this means you've placed it in a Subform, which means you have to refer to the object differently:

 [IID]=[Forms]![YourNavigationForm].[YourSubformCONTROL].[Form].[Interventions]![IID]

Where "YourSubformCONTROL" is the name of the Subform control on YourNavigationForm. It may or may not be named the same as the form you're using as the SourceObject - and in fact, if this is a Navigation Form, it most likely will not be. This trips up a lot of new developers, so be careful and make sure you're reviewing the properties for the correct object.
0
 

Author Comment

by:tmckeating
ID: 39910303
Ok I have tried the following and it does not work. I don't think I understand what the subformcontrol means is that a filed or the name of a form?

[IID]=[Forms]![Admin].[IID].[Form].[Interventions]![IID]

My navigation form with all the tabs on it is called admin. I have a tab on that called Interventions which lists the IID which is the primary key. when I click the IID in the interventions form I want it to open up the Update register form for this IID both forms have an IID field.

Thanks
0
 
LVL 85
ID: 39910456
The Subform Control is just another Control on the form, like a Textbox or Combo.

I can't tell you the exact code, since I don't know your object names or structure. But the syntax is like this:

Forms![ParentForm].[SubformCONTROL].Form.[YourField]

The word "Form" is the one thing you do NOT change in that statement.

So as an example, if I have a Form named "fCustomer", and I have a Subform CONTROL on that form named "scAddresses", and that Subform CONTROL houses a form named "fAddress", and I want to get the value of txPhone on the fAddress form, I'd do this:

Msgbox Forms![fCustomer].[scAddresses].Form.[txPhone]

Note I did NOT refer to the "fAddress" form directly - I got the "handle" for that from the Form object of the subform control named "scAddresses".
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 

Author Comment

by:tmckeating
ID: 39910725
Sorry for being a complete numpty!. I don't think that works for my database if you open my admin form and go to the interventions tab. I want to double click the interventions ID (IID) and for the associated record to open on the update register form. I have attached so you can see.

I have attached it.
Star-Project.accdb
0
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1400 total points
ID: 39914724
Get rid of the macro (in fact, get rid of ALL those macros and use VBA).

Set your Double Click event of your "IID" textbox on the INterventions subform to "Event Procedure", then add code like this:

Private Sub IID_DblClick(Cancel As Integer)
DoCmd.OpenForm "Update Register", , , "IID=" & Me.IID
End Sub
0
 

Author Comment

by:tmckeating
ID: 39914885
I used to use VBA and in 2010 it seems to automatically want to use macros when you create action buttons.

Thanks for that.

Tricia
0
 
LVL 85
ID: 39915683
You can tell 2010 to default to using Event Procedures. In Access options, click "Object Designers" and find the "Form/Report design view" section, then check the box for "Always use event procedures".
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question