Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    New Lounger
    Join Date
    Jul 2010
    Location
    Atlanta
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have acheck boxes connected to each tab. when i check one check box it is make one of the tab visible and others unvisible.but the problem i have when i go to next record it is showing the last tab was visible.

    Private Sub PeradigmCorrect_Click()
    If Me.PeradigmCorrect = True Then
    Me.PeradigmHasBeenUpdated.Visible = True
    Else
    Me.PeradigmHasBeenUpdated.Visible = False
    Me.PeradigmUpdateinProcess.Visible = False
    Me.PeradigmNeedsUpdating.Visible = False
    End If
    If Me.PeradigmCorrect = True Then
    Me.PeradigmBeingUpdated.Locked = True
    Me.PeradigmNeedsUpdate.Locked = True
    Else
    Me.PeradigmBeingUpdated.Locked = False
    Me.PeradigmNeedsUpdate.Locked = False
    End If
    End Sub

  2. #2
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    You need to put something similar into the On Current Event to set the tabs to how you would expect them to be when you change records.

    The On Current event is triggered when you change records whereas a Click event makes a changes that stays fixed until something else changes it.
    Andrew

  3. #3
    New Lounger
    Join Date
    Jul 2010
    Location
    Atlanta
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    when i run Current Event Sub I am getting Run time errow '2165'

    Private Sub Form_Current()
    If Me.PeradigmCorrect = True Then
    Me.PeradigmHasBeenUpdated.Visible = True
    Else
    Me.PeradigmUpdateinProcess.Visible = False
    Me.PeradigmNeedsUpdating.Visible = False
    End If
    If Me.PeradigmCorrect = True Then
    Me.PeradigmBeingUpdated.Locked = True
    Me.PeradigmNeedsUpdate.Locked = True
    Else
    Me.PeradigmBeingUpdated.Locked = False
    Me.PeradigmNeedsUpdate.Locked = False
    End If
    If Me.PeradigmBeingUpdated = True Then
    Me.PeradigmUpdateinProcess.Visible = True
    Else
    Me.PeradigmHasBeenUpdated.Visible = False
    Me.PeradigmNeedsUpdating.Visible = False
    End If
    If Me.PeradigmBeingUpdated = True Then
    Me.PeradigmCorrect.Locked = True
    Me.PeradigmNeedsUpdate.Locked = True
    Else
    Me.PeradigmCorrect.Locked = False
    Me.PeradigmNeedsUpdate.Locked = False
    End If
    If Me.PeradigmNeedsUpdate = True Then
    Me.PeradigmNeedsUpdating.Visible = True
    Else
    Me.PeradigmHasBeenUpdated.Visible = False
    Me.PeradigmUpdateinProcess.Visible = False
    End If
    If PeradigmNeedsUpdate = True Then
    Me.PeradigmCorrect.Locked = True
    Me.PeradigmBeingUpdated.Locked = True
    Else
    Me.PeradigmCorrect.Locked = False
    Me.PeradigmBeingUpdated.Locked = False
    End If

    End Sub

  4. #4
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    You should really have continued this on last thread rather than add a new one.
    It just stops it all getting split up.

    The error 2165 means you are trying to hide some control which currently has the focus

    You need to make sure that you set the focus to a control that is not in the target list of the On Current event
    Easiest way, is to set the focus outside of any of these, to some other control.
    If you are hiding Tabs, then a control inside that tab cannot have the focus.
    Andrew

  5. #5
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts
    Per Andrew's suggestion, I merged your second post into this thread.
    Wendell

  6. #6
    New Lounger
    Join Date
    Jul 2010
    Location
    Atlanta
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have a check boxes connected to each tab. when i check one check box it is make one of the tab visible and others unvisible.but the problem i have when i go to next record it is showing the last tab was visible. I still have this problem.I just attach all DB with the form, So you be able to see actual picture. please help me to fix this problem. Please see attachment.Thanks
    Attached Files Attached Files

  7. #7
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    It is the ELSE part of many of your checks that is causing the problem.
    The else part during on current is clearing the settings from the true part.
    You need to have a good look at the logic behind these.

    Also you need to consider what happens to existing checks when status changes from
    Needs Updating => Being Updated => Corrected
    If you keep them all in, then that is going to cause issues with testing.
    I have attached an example with changes that assumes that only one can be ticked,
    and correctly switches state.

    However, UNLESS a package can exist in 2 states
    eg: Needs Updating, Being Updated at the same time,
    then I think you would have been better off using
    either a combo box with the three options in it
    Or an option group with 4 states
    0=No Status
    1=Needs Updating
    2=Being Updated
    4=Corrected

    Just ideas

    Have a look at the attached, which is similar to yours.
    I have used an IF...ELSEIF structure to run through the states, rather than Multiple IF's

    [attachment=89446:Returned Mail Tracker Updated.zip]
    Attached Files Attached Files
    Andrew

  8. #8
    New Lounger
    Join Date
    Jul 2010
    Location
    Atlanta
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    it is works but when i go to new record i need all tabs make unvisible and check boxes unlocked.

    Thanks for your help.

    Private Sub Form_Current()

    'In the original version, the else parts where removing the settings of the true part
    'I think an elseif is the way to go

    If Me.PeradigmNeedsUpdate = True Then
    'Set Tab Visibility
    PeradigmNeedsUpdating.Visible = True
    PeradigmHasBeenUpdated.Visible = False
    PeradigmUpdateinProcess.Visible = False
    'Set Control Locked Status
    PeradigmNeedsUpdate.Locked = False
    PeradigmBeingUpdated.Locked = True
    PeradigmCorrect.Locked = True
    ElseIf Me.PeradigmCorrect = True Then
    'Set Tab Visibility
    PeradigmNeedsUpdating.Visible = False
    PeradigmHasBeenUpdated.Visible = True
    PeradigmUpdateinProcess.Visible = False
    'Set Control Locked Status
    PeradigmNeedsUpdate.Locked = True
    PeradigmBeingUpdated.Locked = True
    PeradigmCorrect.Locked = False
    ElseIf Me.PeradigmBeingUpdated = True Then
    'Set Tab Visibility
    PeradigmNeedsUpdating.Visible = False
    PeradigmHasBeenUpdated.Visible = False
    PeradigmUpdateinProcess.Visible = True
    'Set Control Locked Status
    PeradigmNeedsUpdate.Locked = True
    PeradigmBeingUpdated.Locked = False
    PeradigmCorrect.Locked = True
    End If

    End Sub

  9. #9
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    In that case you need to use and additional condition on the On Current.

    I'd start it it with

    Code:
    IF Me.Newrecord
        What to do when it is New
    Else
       The existing Current code including the IF
    Endif
    Andrew

  10. #10
    New Lounger
    Join Date
    Jul 2010
    Location
    Atlanta
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What did you mean by "The existing Current code including the IF"

  11. #11
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Whatever you have already that does not handle the New Record
    Andrew

  12. #12
    New Lounger
    Join Date
    Jul 2010
    Location
    Atlanta
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So, what do i need to do to handle New Record?

    Thanks

  13. #13
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Well something like this I guess

    You will have to adapt it to suit what you actually want it to do

    Code:
    Private Sub Form_Current()
    
    'In the original version, the else parts where removing the settings of the true part
    'I think an elseif is the way to go
    
    LastName.SetFocus
    If Me.NewRecord Then
      PeradigmNeedsUpdating.Visible = True
      PeradigmHasBeenUpdated.Visible = True
      PeradigmUpdateinProcess.Visible = True
      PeradigmNeedsUpdate.Locked = False
      PeradigmBeingUpdated.Locked = False
      PeradigmCorrect.Locked = False
    Else
      If Me.PeradigmNeedsUpdate = True Then
        'Set Tab Visibility
        PeradigmNeedsUpdating.Visible = True
        PeradigmHasBeenUpdated.Visible = False
        PeradigmUpdateinProcess.Visible = False
        'Set Control Locked Status
        PeradigmNeedsUpdate.Locked = True
        PeradigmBeingUpdated.Locked = False
        PeradigmCorrect.Locked = True
      ElseIf Me.PeradigmCorrect = True Then
        'Set Tab Visibility
        PeradigmNeedsUpdating.Visible = False
        PeradigmHasBeenUpdated.Visible = True
        PeradigmUpdateinProcess.Visible = False
        'Set Control Locked Status
        PeradigmNeedsUpdate.Locked = True
        PeradigmBeingUpdated.Locked = True
        PeradigmCorrect.Locked = True
      ElseIf Me.PeradigmBeingUpdated = True Then
        'Set Tab Visibility
        PeradigmNeedsUpdating.Visible = False
        PeradigmHasBeenUpdated.Visible = False
        PeradigmUpdateinProcess.Visible = True
        'Set Control Locked Status
        PeradigmNeedsUpdate.Locked = True
        PeradigmBeingUpdated.Locked = True
        PeradigmCorrect.Locked = False
      End If
    End If
    
    End Sub
    Andrew

  14. #14
    New Lounger
    Join Date
    Jul 2010
    Location
    Atlanta
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you for the response, but for new record I need all tabs to be unvisible and check boxes unlock and when I click on one of the check box I need one the tab related to this check box to be VISIble and other unvisible.

    Thanks

  15. #15
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    If you look at the code I posted you ought to be able to adapt it to your needs.
    Andrew

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •