473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Custom Navigation Button Woes

I am having some trouble with some old code revolving around custom
form navigation buttons. My main form has a sub-form with these custom
navigation buttons. In other words, the code should be modular and
work across forms and sub-forms. My previous code was taken from the
Access Expert Solutions 97 (Leszynski) many years ago. As my database
became more complex with multiple sub-forms and intricate combo boxes,
the code faltered.

Some excerpts from the code follow. These areas may point to some of
the idiosyncrasies. Error handling has been excludes for this post.
Private Sub btnNext_Click()

Call FrmFocusSave(Screen.PreviousControl)
Call FrmNavGotoNext(Screen.ActiveForm)
Call FrmFocusRestore

End Sub

Public Sub FrmFocusSave(ctl As Control)
' Purpose: Save a pointer to the active control

Set mctlFocusSave = ctl ' Save the pointer
End Sub
Public Sub FrmNavGotoNext(rfrm As Form)
' Purpose: Goto next record in form recordset

If rfrm.mtdValidate Then ' Record is valid
If Not FrmNavIsLast(rfrm) Then
rfrm.SetFocus ' Just to be sure
Application.RunCommand acCmdRecordsGoToNext
End If
End If
End Sub

Screen.ActiveForm seems to have issues when placed behind the
navigation buttons of a sub-form. The Screen.ActiveForm grabs the
main form (not the sub-form). Screen.PreviousControl may have a
similar effect. The screen method does not aid the debugging process
since the debugging window has focus not a form. Maybe, another
approach exist. Please let me know another approach to custom
navigation buttons. In addition, how does acquire the previous
control and active form in a bulletproof manner.

The sub-form may have additional issues, but I save the specifics for
the next post. Just keep in mind that each form may be open by another
form in dialog mode. So I am continually jumping from one form to
another. The custom navigation button should allow for this usage.

Nov 12 '05 #1
1 3515
I have some additional details about my database dilemma.

My original custom navigation buttons perform as expect if you open
the form in normal view. The custom navigation buttons falter when you
open the form on a particular record. In other words, open the Project
form the database window, the navigation buttons work. Open the
Project form and select the Company tab, then press the command
button, which opens the Company form on the selected company record,
the custom navigation button stumble. Maybe, the custom navigation
buttons trip on filtered forms (hmm).

Please let me know if you have any workarounds for this situation.
The code for the command button follows. Does anybody have a better
way for opening forms with a command button? In addition, I could
still use another approach to custom navigation buttons.
Private Sub cmdGoComp_Click()

Dim strDocName As String
Dim strLinkCriteria As String

strDocName = "frmComp"

strLinkCriteria = "[CompID]=" & Me![tblComp.CompID]
DoCmd.OpenForm strDocName, , , strLinkCriteria, acFormEdit,
acWindowNormal

End Sub
On Wed, 04 Feb 2004 11:52:13 -0800, Robert Neville
<robert_neville@y@h0o.com> wrote:
I am having some trouble with some old code revolving around custom
form navigation buttons. My main form has a sub-form with these custom
navigation buttons. In other words, the code should be modular and
work across forms and sub-forms. My previous code was taken from the
Access Expert Solutions 97 (Leszynski) many years ago. As my database
became more complex with multiple sub-forms and intricate combo boxes,
the code faltered.

Some excerpts from the code follow. These areas may point to some of
the idiosyncrasies. Error handling has been excludes for this post.
Private Sub btnNext_Click()

Call FrmFocusSave(Screen.PreviousControl)
Call FrmNavGotoNext(Screen.ActiveForm)
Call FrmFocusRestore

End Sub

Public Sub FrmFocusSave(ctl As Control)
' Purpose: Save a pointer to the active control

Set mctlFocusSave = ctl ' Save the pointer
End Sub
Public Sub FrmNavGotoNext(rfrm As Form)
' Purpose: Goto next record in form recordset

If rfrm.mtdValidate Then ' Record is valid
If Not FrmNavIsLast(rfrm) Then
rfrm.SetFocus ' Just to be sure
Application.RunCommand acCmdRecordsGoToNext
End If
End If
End Sub

Screen.ActiveForm seems to have issues when placed behind the
navigation buttons of a sub-form. The Screen.ActiveForm grabs the
main form (not the sub-form). Screen.PreviousControl may have a
similar effect. The screen method does not aid the debugging process
since the debugging window has focus not a form. Maybe, another
approach exist. Please let me know another approach to custom
navigation buttons. In addition, how does acquire the previous
control and active form in a bulletproof manner.

The sub-form may have additional issues, but I save the specifics for
the next post. Just keep in mind that each form may be open by another
form in dialog mode. So I am continually jumping from one form to
another. The custom navigation button should allow for this usage.


Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Stephen | last post by:
This is a real brain-teaser and i'd really appreciate it if someone can try and understand what im trying to do and give me a few pointers or ideas to help me work out my problem. Im basically...
2
by: Jay Walker | last post by:
I created a custom DataGridColumn based on Marcie Robillard's MSDN Article: Creating Custom Columns for the ASP.NET Datagrid...
0
by: sd | last post by:
I have created a custom navigation control that I'm registering with the set of aspx pages that will call it. The navigation control will display or hide various navigation elements based on the...
19
by: Jamey Shuemaker | last post by:
I'm in the process of expanding my knowledge and use of Class Modules. I've perused MSDN and this and other sites, and I'm pretty comfortable with my understanding of Class Modules with the...
27
by: Wayne | last post by:
I've been clicking around Access 2007 Beta 2 and can't see the custom menu bar designer. Is it in the beta? Maybe I'm blind. The question that comes to mind is: Will custom menu bars be the same...
1
by: Jakob Lithner | last post by:
When I started a new ASP project I was eager to use the login facilities offered in Framework 2.0/VS 2005. I wanted: - A custom principal that could hold my integer UserID from the database -...
4
by: aaronyoung | last post by:
I have created custom navigation buttons and Record Number indicators on several forms that are used to review and update records based on a query. My On Current event to update the "Record X of...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.