Solved Navigation Buttons on a form (1 Viewer)

mloucel

Member
Local time
Today, 15:57
Joined
Aug 5, 2020
Messages
158
Hello Gurus..

SORRY NEVER MIND I FOUND MY STUPID ERROR PLEASE IGNORE

I have been working on a form that believe it or not the Navigation buttons are pretty much a match made in heaven for the form, BUT... there is a point on the execution of the code that I NEED the navigation buttons to simply be turned off..
I have tried the following code:
Code:
Me.NavigationButtons = False

and of course immediately after my procedure is done successfuly I turn that "True" but it doesn't work
here is the full code:
Code:
Private Sub btnNew_Click()
       
    NR = True 'New Record Pointer
    UseButton = True 'Displays the Cancel Button
    CancelBtn.Visible = True
    Me.NavigationButtons = False ' This code is NOT working
    DoCmd.GoToRecord acDataForm, Me.Name, acNewRec

' There is a procedure that stops the next line to be executed
' if the user does not fill ALL the requiered fields.
' Once that is done the subform is displayed

    Me.PatientNotesSF.Form.Visible = False
    UseButton = False
    Me.NavigationButtons = True

End Sub

ANY help will be greatly appreciated..

Maurice.
 
Last edited:

Gasman

Enthusiastic Amateur
Local time
Today, 23:57
Joined
Sep 21, 2011
Messages
14,336
So please reveal your error. It might help others in the future?
That is what these forums are all about after all.
 

mloucel

Member
Local time
Today, 15:57
Joined
Aug 5, 2020
Messages
158
So please reveal your error. It might help others in the future?
That is what these forums are all about after all.
Sorry @Gasman you are absolutly right..
Well here it is:
I used toggle points to run my code, I saw that I execute "Me.NavigationButtons=True" right after all my initial code effectively canceling the "FALSE"
So I moved that line of code to my procedure where I FORCE the user to use the SAVE button, so here are the final codes that works like MAGIC.

Button NEW, Navigation buttons turned off so that I force the EU to a limited interaction and 2 buttons, CANCEL or SAVE:

Code:
Private Sub btnNew_Click()
    'Me.AllowAdditions = True for continuos forms
        
    NR = True
    UseButton = True
    CancelBtn.Visible = True
    Me.NavigationButtons = False
    DoCmd.GoToRecord acDataForm, Me.Name, acNewRec

    Me.PatientNotesSF.Form.Visible = False
    UseButton = False
    'Me.AllowAdditions = False ' for continuos forms
End Sub

Now I activate the Navigation Buttons, if certain conditions are met:

Code:
Private Sub SaveBtn_Click()

    If DataValid(Me) And NR = True Then
        Me.PatientNotesSF.Form.Visible = True
        CancelBtn.Visible = False
        NR = False
        Me.NavigationButtons = True
        Exit Sub
    End If
    
    If Me.Dirty Then
        If CancelBtn.Visible = True Then CancelBtn.Visible = False
        Me.Dirty = False
    End If
    Me.Requery

End Sub
 

Gasman

Enthusiastic Amateur
Local time
Today, 23:57
Joined
Sep 21, 2011
Messages
14,336
Sorry @Gasman you are absolutly right..
Well here it is:
I used toggle points to run my code, I saw that I execute "Me.NavigationButtons=True" right after all my initial code effectively canceling the "FALSE"
So I moved that line of code to my procedure where I FORCE the user to use the SAVE button, so here are the final codes that works like MAGIC.

Button NEW, Navigation buttons turned off so that I force the EU to a limited interaction and 2 buttons, CANCEL or SAVE:

Code:
Private Sub btnNew_Click()
    'Me.AllowAdditions = True for continuos forms
       
    NR = True
    UseButton = True
    CancelBtn.Visible = True
    Me.NavigationButtons = False
    DoCmd.GoToRecord acDataForm, Me.Name, acNewRec

    Me.PatientNotesSF.Form.Visible = False
    UseButton = False
    'Me.AllowAdditions = False ' for continuos forms
End Sub

Now I activate the Navigation Buttons, if certain conditions are met:

Code:
Private Sub SaveBtn_Click()

    If DataValid(Me) And NR = True Then
        Me.PatientNotesSF.Form.Visible = True
        CancelBtn.Visible = False
        NR = False
        Me.NavigationButtons = True
        Exit Sub
    End If
   
    If Me.Dirty Then
        If CancelBtn.Visible = True Then CancelBtn.Visible = False
        Me.Dirty = False
    End If
    Me.Requery

End Sub
Thank you.
 

Users who are viewing this thread

Top Bottom