473,503 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3533
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
1600
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
3169
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
809
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
4890
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
45486
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
4979
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
3467
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
19396
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
2897
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
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7076
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7274
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,...
1
6984
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
5576
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,...
1
5005
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3151
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1507
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
377
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.