Solved

How to goto a record on an Access Navigation form?

Posted on 2014-01-08
10
1,488 Views
Last Modified: 2014-02-04
Issue: I do not know how to use a macro/vba to find/goto a record in a list of records on an access “Navigation” form.

Assumptions: 1) I have a main navigation subform called: FrmAlpha
2) I have a navigation-subform (a tab on the navigation form) called: FrmBravo
3) I have a datasheet (a subform on FrmBravo) that is called: FrmCharlie
4) I have a form I just closed that I used to edited the record I now wish to search for in the FrmCharlie.  I shall call this closed form: FrmClosed

I know I will need to use a unique field from the FrmClosed form to find the same record from the list of records on the navigation sub-sub-form (FrmCharlie).  I have the underlying table’s primary key [ID] that I figure I can use.  Also, I presume I have to affect the focus of the database to look at the navigation sub-sub-form, but I am clueless how to do that.  I have seen posts mentioning GoToControl: NavigationSubform, but I am clearly not using that correctly.  Help!
0
Comment
Question by:iamsickofthisidshtuff
  • 5
  • 4
10 Comments
 
LVL 30

Expert Comment

by:hnasr
ID: 39767075
Upload a sample database. It is difficult to follow when you change default control names .

If you can, reproduce the issue using default names given by access, then specify what to look for.
0
 
LVL 84
ID: 39767491
So you have a sub-sub-subform? If so, you refer to it like this:

Forms("YourMainForm").frmAlpha.Form.frmBravo.Form.frmCharlie.Form.SomeControlOnfrmCharlie

See this page for a good tutorial on referring to subforms: http://access.mvps.org/access/forms/frm0031.htm
0
 

Author Comment

by:iamsickofthisidshtuff
ID: 39769299
Attached is an example database.

In the datasheet, if any of the records is selected, an Edit Form will open.  When the “Done” button is selected, the edit form closes, the database requeries and goes to the first record in the datasheet.  I would like to have the database goto the record that was edited so my users do not need to search for it.  It should happen automatically in the sequence of actions after the “Done” button is pushed.
Example-DB.accdb
0
 
LVL 30

Expert Comment

by:hnasr
ID: 39770044
In the macro, remove Requery.
Example-DB-2.accdb
0
 

Author Comment

by:iamsickofthisidshtuff
ID: 39770808
Understood that the requery causes the database to re-query and go to the first record, and if all I was doing was editing the record, removing that action would be fine.  However, if I add a new record I must requery the database to show that new record on the FrmCharlie form.  Thus the problem still remains.  I want to be able to have the form automatically goto that last record that was edited OR added.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 30

Expert Comment

by:hnasr
ID: 39770849
Your sample does not show how to add.
Modify and upload.
0
 

Author Comment

by:iamsickofthisidshtuff
ID: 39771036
Please find attached DB v2.  On the FrmCharlie form, I have placed an "Add" button.  It opens the FrmEdit form in the ADD data mode.  Still the same edit form, but it only allows the addition of new records.  The "Done" button has the same macro actions.  Thanks for the help.
Example-DB-v2.accdb
0
 
LVL 30

Accepted Solution

by:
hnasr earned 200 total points
ID: 39772166
I am a bit confused with these forms. I guess the design can be simplified.

Try this database. I inserted a stop in the code, to show you the steps. You may remark the stop statements.
Run frmAlpha.
Example-DB-v2-1.accdb
0
 

Author Comment

by:iamsickofthisidshtuff
ID: 39788548
Sorry, I am away on a business trip but will take a look at the solution next week when I get back.  Thanks
0
 

Author Closing Comment

by:iamsickofthisidshtuff
ID: 39833611
The solution works, however I am not proficient enough in code to successfully apply it for my database.  It is apparent I need to take some time to try to understand VBA better.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now