Modules & VBA :: Custom Record Navigation Buttons

Jul 11, 2014

To briefly explain my database; it is a bespoke referral management system within a hospital. Each record on the database contains patient demographic information, as well as information on their referral (i.e. date of referral, date of assessment, date of commencing treatment, discharge date etc.) Therefore, the same patient will appear multiple times in the database, with each separate record corresponding to a unique referral pathway.

The database forms are split to show patient information at the top, with referral information shown in a subform. I am trying to add navigation buttons to the subform that will allow the user to scroll through the referrals corresponding to the patient currently displayed on the main form.

Each patient has a uniquely identifiable number associated with them, and so it seems straightforward enough in my mind to have a button that will search for the record in the database where the patient's number matches the patient number of the current record, and where the referral date is minimum (for "First Referral"), maximum but less than current (for "Previous Referral"), minimum but greater than current (for "Next Referral"), and maximum (for "Last Referral").

View Replies


ADVERTISEMENT

Custom Navigation Buttons

May 24, 2007

Hello all,
I've looked at the examples of custom navigation buttons people have created. Some are better than others, but none of them are fully functional, in my opinion.

I like Stephen Leban's technique; manipulating a Parent's .Recordset from a SubForm. My goal is to create a set of instantly reusable custom navigation buttons.

However, even his code lacks Save and Delete buttons.

In studying this problem, I noticed something about the built-in navigation buttons that nobody seems to have addressed, even those who claim their button set mimics "exactly" the built-in buttons. None do.

And that is that when clicking the "New" button (built-in), the New and Next buttons are disabled. This is fine and expected.

Then, when any field on the form is changed (form made Dirty?), the built-in New and Next are instantly enabled.

Does anyone understand how this is being done?

View 11 Replies View Related

Record Navigation Buttons

Feb 13, 2006

Ok, I am trying to make some sort of thumbnail preview form. The image appears in the imgBox no problem, and it is grabbing it from the field. When I use a combo box to navigate the records it works flawlessly

HOWEVER, I would like my users to be able to press bckwds/fwds arrows so i made some arrows with the wizard and added some code. Heres how it looks

---------------------------------------
Private Sub cmdNext_Click()
On Error GoTo Err_cmdNext_Click

DoCmd.GoToRecord , , acNext
Me.Requery
If Me!SamPhoto = "" Or IsNull(Me!SamPhoto) = True Then
imgSamPhoto.Picture = ""
lblNoPhoto.Visible = True
Else
lblNoPhoto.Visible = False
imgSamPhoto.Picture = Me![SamPhoto]
End If
MsgBox Me!SamPhoto
Exit_cmdNext_Click:
Exit Sub

Err_cmdNext_Click:
MsgBox Err.Description
Resume Exit_cmdNext_Click

End Sub

Private Sub cmdPrevious_Click()
On Error GoTo Err_cmdPrevious_Click


DoCmd.GoToRecord , , acPrevious
Me.Requery
If Me!SamPhoto = "" Or IsNull(Me!SamPhoto) = True Then
imgSamPhoto.Picture = ""
lblNoPhoto.Visible = True
Else
lblNoPhoto.Visible = False
imgSamPhoto.Picture = Me![SamPhoto]
End If

Exit_cmdPrevious_Click:
Exit Sub

Err_cmdPrevious_Click:
MsgBox Err.Description
Resume Exit_cmdPrevious_Click

End Sub

Private Sub Form_Load()
DoCmd.GoToRecord , , acFirst
End Sub

------------------------------------------

My problem is that it never goes to the second record when i press next, and when i press back it says at end of recordset ( which makes sense ) but why would the back button work, and the fwd button do nothing ? I am hoping it is a small syntax error. Please help!

View 6 Replies View Related

Change Colour Of Navigation Buttons And Command Buttons?

Mar 17, 2006

Is this possible? I can't seem to find this q anywhere here so I thought I'd post.

I changed the colour of my form to white, but the Navigation Buttons at the bottom and the command buttons that I 've added stay at the default grey.

Is there anyway to change this? I right-clicked and tried changing it to white through the properties but there's nothing there that does this.

:confused:

View 2 Replies View Related

Change Colour Of Navigation Buttons And Command Buttons?

Mar 17, 2006

Is this possible? I can't seem to find this q anywhere here so I thought I'd post.

I changed the colour of my form to white, but the Navigation Buttons at the bottom and the command buttons that I 've added stay at the default grey.

Is there anyway to change this? I right-clicked and tried changing it to white through the properties but there's nothing there that does this.

:confused:

View 4 Replies View Related

Modules & VBA :: Search Code Deactivates Navigation Buttons When Search Results Are Longer Than A Page

Jun 24, 2015

I have a form that has a subform on it. The main form shows a category of furniture and has custom navigation buttons and a search text box for asset numbers and command button that runs the search. The subform shows the asset numbers associated with that furniture category, sometimes there is only one asset number, in other cases there could be 60. There is a scroll bar to scroll through the asset numbers when there are too many to see in the initial window.

The buttons all work as they should except when I search for an asset number that is part of a category that has too many asset numbers to show in the main window. When this happens the "previous" and "next" navigation buttons do not take you to the previous or next record. All of the other buttons on the form work though - you can go to the first, or the last record, and you can search for a new asset.This is the code for the search:

Code:

Private Sub cmdAssetSearch_Click()
Dim rs As Object
If IsNull(Me.TextAsset) Or Me.TextAsset = "" Then
MsgBox "Please type in an asset number to search for.", vbOKOnly
Me.TextAsset.SetFocus

[code]....

I've also attached a picture of what I mean when I say there are more asset numbers than what the window shows.

View 6 Replies View Related

Navigation Buttons

Feb 26, 2007

I have a field (DueDate) that will blink (flash) if it passes its value

problem is the text to the right of the navigation buttons is not showing the number of records unless I navigate till end of the records.

I tried Me.Requery and Me. Refresh but with no success

View 7 Replies View Related

Navigation Buttons

May 16, 2005

First time user - so please forgive if this is already out there.

I want to hide the navigation buttons on a form and create a custom set of controls. I can create the buttons themselves but am having trouble with the "N of X", where:

X is the total number of records in the query, and
N is the current record showing in the form.

I can get X but how would I capture and display "N".

Any help would be appreciated.

View 4 Replies View Related

Navigation Buttons

Sep 27, 2005

I searched the forum on custom navigation buttons and found great posts about it. I downloaded 3 samples and the one that fit what I needed was SJ McAbney's dbNavSubform.zip. sfrmNavigation (http://www.access-programmers.co.uk/forums/showthread.php?t=87791) I imported sfrmNavigation per SJ McAbney's on the post into my database.

I didn't want to start a new thread so I posted on the thread: http://www.access-programmers.co.uk/forums/showthread.php?t=88880
But I didn't get any responses.. I don't know if it's been overlooked.

I am encountering problems when I use dbNavSubForm in my database.

1. I made 2 copies of sfrmNavigation and I am using it on 2 of my forms.
On the main form that I am using it when I first open the database it shows record 1 of 1 when really there is more than 1 record. When I click on the next button it then goes to say 2 of 15.
How can I fix this so that when I open the database it will say 1 of 15 and not 1 of 1?

2. I have a Main form ex: frmMain and a subform on frmMain. I added the the subform (dbNavSubForm) onto my subform. Make sense? Here the navigation buttons do not work. When I try to add a new record it tells me "The object frmTOItems isn't open" When I try to click on the next or previous it tells me "Object variable or With block variable not set. How can I fix this?

I have captured a picture of my form so that you can see what I mean.

Thanks in advance

View 14 Replies View Related

Navigation Buttons

Apr 6, 2006

I have created my own set of navigation buttons for last previous next first and new records. How can I also create the box which tells you which record you are currently looking at, and the one which tells you how many records there are in total?

Also, an error message comes up when i click previous if on the first record and when I click next when on the last. How do I blank out the previous button when on first record, and how do I change the function of the next button to "new record" when on the last record?

I am trying to do this as I want to move the navigation buttons from the bottom of the screen so if anyone knows a way of doing this without creating all new buttons then that would be even better.

Thanks guys.

View 3 Replies View Related

Navigation Buttons

Jan 21, 2008

I have a form that uses command buttons to navigate from one record to the next. There is also a last record command button that when pressed will go to the last record, but the record indicator does not show the last record (i.e., Record 66 of 66), but show the same record that was active (i.e., Record 5 of 66) when the last record command button is clicked.

Is there any type of code that I can use that will update the record indicator to show the last record when the last record command button is clicked?

Thanks for any help

View 3 Replies View Related

Standard Navigation Buttons?

Apr 12, 2006

Does anybody know if it is possible to set extra code to any of the standard navigation buttons?

In other words, is there is Sub that corresponds to each navigation button that can be modified?

For example, for "Next>", is there a
Private Sub cmdNext_Click()
...
End Sub
???

View 1 Replies View Related

How To Disable Navigation Buttons?

Feb 19, 2005

Hello!
I have little problem. I have form which have linked Child table. On that Child table in a form I have displayed Navigation Buttons. I don`t want to see them, but I can`t disable them. I tried everything.

Please, help..... :confused:

View 3 Replies View Related

Navigation Buttons Problem

Jan 17, 2006

all,

i seem to be having an issue with the navigations buttons on my form

when i open the form nothing happens when i click next but when i click on last record that works then i can go back on the previous and then the next button works.

the code shows as below ...



Private Sub NextRecord_Click()
On Error GoTo Err_NextRecord_Click

If Me.Dirty Then
MsgBox "Please Save This Record!" & vbCrLf & vbLf & "You can not advance from this record until you either 'Save' the changes made to this record or 'Undo' your changes.", vbExclamation, "Save Required"
ElseIf Me.CurrentRecord < Me.RecordsetClone.RecordCount Then
DoCmd.GoToRecord , , acNext
End If

Exit_NextRecord_Click:
Exit Sub

Err_NextRecord_Click:
MsgBox Err.Description
Resume Exit_NextRecord_Click

End Sub



any ideas???

thanks

View 1 Replies View Related

Modules & VBA :: How To Build A Custom Record Delete

Sep 24, 2013

I'd like to override the default behaviour for deleting records in a form.Specifically, I want to build my own custom delete procedure so that when the user presses the Del button, my code fires to complete the deletion of the selected record(s). In order to do that, I'd set Allow Deletions = No for that form. I'd also want to code the KeyDown event for the Del key so that if record(s) are selected, my custom delete code fires, else the default behavior for the Del key happens.I'm primarily interested in how I might code the KeyDown event.

View 12 Replies View Related

Modules & VBA :: Custom Record Counter Of A Form?

Jan 27, 2015

I have a custom record counter on a form using the below code:

Private Sub Form_Current()
If Me.NewRecord Then
Me.lblRecordCounter.Caption = _
"Record " & Me.CurrentRecord & " of " & Me.Recordset.RecordCount + 1
Else
Me.lblRecordCounter.Caption = _
"Record " & Me.CurrentRecord & " of " & Me.Recordset.RecordCount
End If
End Sub

I think at some stage the form was saved with a filter on and this may be causing the issue. The problem I have is:

There are 1749 records. Everytime I open the form the custom record counter displays "Record 1 of 501". The built in record counter shows 1 of 1749. The moment I hit the next record arrow the custom record counter displays "2 of 1749" and if I go back again it displays "1 of 1749.".

I know it's a filter causing the problem because I have a macro that does a clear search. As soon as I hit the clear search the custom counter goes back to "1 of 501" again (even though the built in one stays at 1 of 1749).

I have Filter on Load set to No.

what I am doing wrong?

View 13 Replies View Related

Modules & VBA :: Delete A Record With Custom CMD Button

Jul 12, 2015

I am building a db for reservations for my limo company. I want to have a cmd button that verifies the user to make sure she wants to delete a run. This is what I have so far:

Private Sub cmdDeleteRun_Click()
Dim Response
Response = msgbox("Are you sure you want to delete this run?", vbYesNoCancel + vbCritical, "Really delete run?")
If Response = vbYes Then

End Sub

I don't know what I am missing for the cmd to actually delete it.

View 3 Replies View Related

Removing The Navigation Buttons On The Forms.

Aug 30, 2006

Sorry if this is too trivial to be posted as a new thread, I have spent a considerable amount of time trying to do this but have failed miserably.

I want to remove the set of command buttons at the bottom of the forms, (the navigation buttons to move the next record etc.) as i want to create my own. And also when I have got two or more subforms this looks too cluttered.

Can anyone help me?

Thanks.

View 1 Replies View Related

Import Custom .ocx File For Pretty Buttons

May 23, 2007

Hi! I'm working in Access 2007, and am having difficulty figuring out how to do the following.

I purchased some pretty .ocx buttons that I want to use in my db. I can't figure out how to import them for use. No, I don't want to just copy and paste them in. Any ideas? I hate the ugly, unprofessional looking command buttons in Access. Thank you!

KellyJo

View 2 Replies View Related

Forms :: Filter And Sort Using Custom Buttons

Sep 24, 2013

I am using Microsoft Access 2010. It provides great filtering and sorting options in the ribbon for any object. But what if I hide the ribbon and want to create custom buttons on the form to do the filtering and sorting job? There are some filter options available in macros but are not quite like the ribbon's own Filter button. When the Filter button is clicked from the Robbin, a filter menu pops-up under the active field, which doesn't happen when I try to do it using Macro functions like "Apply Filter" or "Set Filter" etc. I want to have that big "FILTER" button from the Ribbon on my form.

View 2 Replies View Related

Create 3 Custom Caption Buttons For A Message Box?

Nov 18, 2013

Is it possible to create 3 custom caption buttons for a message box?

I know I could do this as a form, but would like to know if it can be done in vba using msgbox...

View 2 Replies View Related

Adding Code To My Navigation Command Buttons

Dec 19, 2005

I have a students database with fields like

Id
Name
Address
City
State

I have a mainform with just two fields (Name and State)
and then a subform, I want to be able to enter students name or state on a field in my mainform and click on FindStudent, and it displays the record on my subform.

I also want to have a AddNew record button on my main form, and when it's clicked, i will be able to enter data into the underlying table using my subform.

How do i achieve this?
Any input will be greatly appreciated. Thanks :) :)

View 2 Replies View Related

Forms :: VBA To Load New Form Navigation Buttons?

Sep 5, 2014

I need to execute some VBA to load a new form in my navigation view, not a popup form.

If use DoCmd.OpenForm "DB History" it opens the form as a new form.

DoCmd.BrowseTo acBrowseToForm, "DB History" set the focus on the DB History navigation button but doesn't open it.

So I think I need to add the path.

'DoCmd.BrowseTo ObjectType:=acBrowseToForm, ObjectName:="DB History", 'PathToSubformControl:="??"

This is where I am stuck.

My main form is Navigation Form1

The sub ins NavigationSubForm

and the form loaded is Form1 which I would like to replace with DB History

View 5 Replies View Related

Forms :: Disable Other Navigation Buttons Tab When One Tab Is Active

Jul 26, 2015

I have few forms for which I have created a navigation form. Now in this navigation form, I have 4 tabs/ forms. I want to disable other 3 tabs/ forms when either of the one is active. I want to restrict user from switching the tab leaving the task incomplete in one tab.

It should show a popup msg, that "the task is active. Please submit before leaving the page."

View 1 Replies View Related

Forms :: Disable Navigation Buttons On Form

Mar 20, 2015

In A2007 if you disable the Navigation Buttons on the form the Me.RecordCount will be set to 1 when the form opens ? I replace the Nav buttons with my own set but my "Go Next" button will not work untill I hit "Go to Last". This apparently restores the recordset count to the correct number of records.

View 14 Replies View Related

Using Buttons To Hide / Unhide Navigation Pane

Jul 22, 2014

I would like to hide/unhide the navigation pane completely by using two buttons (pop the hood & close the hood) in a form. At this moment I used the following code:

Private Sub Command77_Click()
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide
End Sub
Private Sub Command78_Click()
DoCmd.SelectObject acTable, , True
End Sub

This however makes my form shut down and not my navigation pane.

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved