Controls Flying?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yaaara
    New Member
    • Aug 2008
    • 77

    Controls Flying?

    Guys,

    I'm facing a wierd problem and don't exactly know where the glitch is.

    I have a form with Tab control in Access 2003. In each tab, I have a text box and two Datepicker controls. The wierd part is that sometimes (not all the times), as soon as I press the Tab key in the textbox, the Datepicker controls "Fly" to the topmost left corner of the form. I have checked every bit n piece of the code that I have written, but nowhere am I changing the position of the controls.

    The following is the code written for the Text Box:

    Code:
    Private Sub txtEmpIDATT_Exit(Cancel As Integer)
        If txtEmpIDATT.Text = "" Then
            'do nothing
        Else
            Call cmdHidden1_Click
        End If
    End Sub
    
    Private Sub cmdHidden1_Click()
        On Error GoTo errr
        Call conDB
        EID = Trim(txtEmpIDATT.Text)
        vSQL = "select emp_name,function from emp_master where emp_id=" & EID
        Set rsMain = conMain.Execute(vSQL)
        If rsMain.BOF = True Then
            MsgBox "Either the Employee ID is incorrect or the employee doesn't exist in records.", vbCritical, "Employee ID"
            Call att_reset
        Else
            txtEmpNameAtt.Caption = rsMain(0) & "/" & rsMain(1)
            DTLWD.Enabled = True
            DTDOA.Enabled = True
            If rsMain(1) = "Attrition" Then
                MsgBox "This employee has already attrited.", vbCritical, "Attrition"
                Call att_reset
            Else
                'do nothing
            End If
        End If
        Exit Sub
    errr:
        MsgBox Err.Description
        Set rsMain = Nothing
        Set conMain = Nothing
    End Sub
    
    Private Sub att_reset()
        txtEmpIDATT.SetFocus
        txtEmpIDATT.Text = ""
        txtEmpNameAtt.Caption = ""
        DTLWD.Enabled = False
        DTDOA.Enabled = False
    End Sub
    I'm also attaching the screenshots of the form for reference.

    Hoping someone would have a clue and come up with a solution please......

    Thanks.......
    Attached Files
    Last edited by yaaara; Sep 4 '08, 09:19 AM. Reason: Attachment Added
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Hi Yaaara. Nothing obvious jumps out from your code.

    You'll need to check the LEFT and TOP attributes of the controls concerned. You can add before and after msgbox statements in your code to see if this sheds any light on it, like this:

    Code:
    with Me![yourtextboxname]
      msgbox("Left = " & .Left & " Top = " & .Top)
    end with
    As a start you could place code like this in the On Focus and After Update events of your textboxes. If the Left or Top attributes are different something has changed them - then the debug checks begin in earnest...

    If not there is a bug of some kind somewhere...

    -Stewart

    Comment

    • yaaara
      New Member
      • Aug 2008
      • 77

      #3
      Thanks for the prompt response Stewart, but this doesn't happen all the time. Had this been happening every time, I would have assumed that there is something to do with the Left & the Top attributes.. Its just at random times that this happens while at other times, the controls stay where they are supposed to be...

      Originally posted by Stewart Ross Inverness
      Hi Yaaara. Nothing obvious jumps out from your code.

      You'll need to check the LEFT and TOP attributes of the controls concerned. You can add before and after msgbox statements in your code to see if this sheds any light on it, like this:

      Code:
      with Me![yourtextboxname]
        msgbox("Left = " & .Left & " Top = " & .Top)
      end with
      As a start you could place code like this in the On Focus and After Update events of your textboxes. If the Left or Top attributes are different something has changed them - then the debug checks begin in earnest...

      If not there is a bug of some kind somewhere...

      -Stewart

      Comment

      • yaaara
        New Member
        • Aug 2008
        • 77

        #4
        I also put the code you advised in the GotFocus, AfterUpdate and Exit events of the text box..

        To my surprise, the message box pops up with the attributes in the GotFocus event, but not for any other events.. Not sure why this is happening..

        Any clues?

        Originally posted by yaaara
        Thanks for the prompt response Stewart, but this doesn't happen all the time. Had this been happening every time, I would have assumed that there is something to do with the Left & the Top attributes.. Its just at random times that this happens while at other times, the controls stay where they are supposed to be...

        Comment

        • yaaara
          New Member
          • Aug 2008
          • 77

          #5
          Also, when I Tab out of the text box and the control has moved, when I click on the Text box again (To invoke the GotFocus event), the message box pops up again with the same Left and Top values for the datepicker control like the way it was before movement...



          Originally posted by yaaara
          I also put the code you advised in the GotFocus, AfterUpdate and Exit events of the text box..

          To my surprise, the message box pops up with the attributes in the GotFocus event, but not for any other events.. Not sure why this is happening..

          Any clues?

          Comment

          • Stewart Ross
            Recognized Expert Moderator Specialist
            • Feb 2008
            • 2545

            #6
            Hi Yaaara. I do understand that it is just sometimes. In my view, either there is a bug in the product, or there is something changing the physical position of your controls. You need to eliminate or reduce the possibilities systematically, no matter how infrequently the problem is occurring.

            I have used tabbed pages in Access 2003 applications for some time. In more than nine months of use of one application by five users I have never experienced such a failure, nor have I heard of it before, nor (as far as I know) has it been identified by other posters to Bytes in the past six months.

            If I was in your position I would be deliberately trying to induce failure so that the debug code can assist in verification of whether or not the Left and Top attributes are as expected. If they are not, I repeat, something has changed them - and you need to find what it is. If they are the same, you will have eliminated control position as the problem - and you then need to deal with whether or not there is a bug in Access itself that could be causing the failure.

            -Stewart

            Comment

            • yaaara
              New Member
              • Aug 2008
              • 77

              #7
              How can we find whether it is a known bug or something else?

              Originally posted by Stewart Ross Inverness
              Hi Yaaara. I do understand that it is just sometimes. In my view, either there is a bug in the product, or there is something changing the physical position of your controls. You need to eliminate or reduce the possibilities systematically, no matter how infrequently the problem is occurring.

              I have used tabbed pages in Access 2003 applications for some time. In more than nine months of use of one application by five users I have never experienced such a failure, nor have I heard of it before, nor (as far as I know) has it been identified by other posters to Bytes in the past six months.

              If I was in your position I would be deliberately trying to induce failure so that the debug code can assist in verification of whether or not the Left and Top attributes are as expected. If they are not, I repeat, something has changed them - and you need to find what it is. If they are the same, you will have eliminated control position as the problem - and you then need to deal with whether or not there is a bug in Access itself that could be causing the failure.

              -Stewart

              Comment

              • Stewart Ross
                Recognized Expert Moderator Specialist
                • Feb 2008
                • 2545

                #8
                Might be worth searching the Microsoft Knowledge Base to find out if there are any known issues with control positioning.

                It is interesting that both controls appear to be forced to the same top-left location when this happens; is there any other control placed on the form nearby on a hidden basis which might be causing interference here?

                -Stewart

                Comment

                • yaaara
                  New Member
                  • Aug 2008
                  • 77

                  #9
                  No other control exists on the form... Interesting for me too as I encountered this situation for the first time... I hope to find something at the MS Knowledge Base.. Will surely let all know if any information is found..

                  Thanks for your prompt response anyways :-)

                  Originally posted by Stewart Ross Inverness
                  Might be worth searching the Microsoft Knowledge Base to find out if there are any known issues with control positioning.

                  It is interesting that both controls appear to be forced to the same top-left location when this happens; is there any other control placed on the form nearby on a hidden basis which might be causing interference here?

                  -Stewart

                  Comment

                  • yaaara
                    New Member
                    • Aug 2008
                    • 77

                    #10
                    All I could find was the following article BUG: Office repaint problem if modal form is shown from ActiveX EXE

                    Although I don't think this applies directly to my issue, it may be related.. Any suggestions?

                    Originally posted by yaaara
                    No other control exists on the form... Interesting for me too as I encountered this situation for the first time... I hope to find something at the MS Knowledge Base.. Will surely let all know if any information is found..

                    Thanks for your prompt response anyways :-)

                    Comment

                    • Stewart Ross
                      Recognized Expert Moderator Specialist
                      • Feb 2008
                      • 2545

                      #11
                      Reviewing the article I doubt it applies in your circumstances, but can't be sure. I'll ask colleagues on the Forum for their opinion to see if they have any better ideas about what might be happening.

                      -Stewart

                      Comment

                      • yaaara
                        New Member
                        • Aug 2008
                        • 77

                        #12
                        Thanks a ton Stuart.. Any help will be highly appreciated :-)

                        Originally posted by Stewart Ross Inverness
                        Reviewing the article I doubt it applies in your circumstances, but can't be sure. I'll ask colleagues on the Forum for their opinion to see if they have any better ideas about what might be happening.

                        -Stewart

                        Comment

                        • nico5038
                          Recognized Expert Specialist
                          • Nov 2006
                          • 3080

                          #13
                          Hmm, quite extraordinary and never seen before.
                          (And I've used tabbed controls intensively..)

                          My first impression is an Access failure and a sign of a corrupt database.
                          I would execute my set of standard "corrupt database steps":
                          1) Create a backup of the corrupt database. (Just in case of)

                          2) Create a new database and use File/Get external data/Import to get all objects of the damaged database.

                          3) Try these Microsoft solutions:
                          Repair A97/A2000:

                          Jetcomp:

                          and/or read the article:
                          ACC2000: How to Troubleshoot Corruption in a Microsoft Access Database

                          (Or look for similar info on 2003 when you use that)

                          4) Bit "heavier":
                          Access decompile:



                          check also: http://www.granite.ab.ca/access/corruptmdbs.htm

                          Sometimes a complete reinstall of Office solved strange problems for me too.

                          Nic;o)

                          Comment

                          • missinglinq
                            Recognized Expert Specialist
                            • Nov 2006
                            • 3533

                            #14
                            I've used tabbed forms for years and have never experienced anything like this nor have I read reports of this type of behavior anywhere. My first thought was identical to Nico's, that we're dealing with some type of corruption.

                            Probably worth trying the old create-a-blank-database-and-import-everything-into-it routine before doing anything else. Actually, might be worthwhile to first try deleting then re-creating the offending textbox.

                            Linq ;0)>

                            Comment

                            • yaaara
                              New Member
                              • Aug 2008
                              • 77

                              #15
                              Guys, Thanks for your inputs on this..

                              Just to clarify, its not the textbox but the Datepicker control which is flying around. (may be this changes some thoughts?)
                              Also, there are two datepicker controls in each tab (5 tabs in all, so 10 controls) and each one acts up randomly.
                              Also, it is a fresh installation of Office 2003.
                              I have tried Compacting and Repairing the database using the usual menu option.
                              After going through the advise by Nico, I tried the create-a-blank-database-and-import-everything-into-it routine, but same result.

                              I'm constantly looking up the MS Knowledgbase articles to find something meanwhile.. The problem is wierd, I know, but then that's the way it is at the moment :-(

                              Originally posted by missinglinq
                              I've used tabbed forms for years and have never experienced anything like this nor have I read reports of this type of behavior anywhere. My first thought was identical to Nico's, that we're dealing with some type of corruption.

                              Probably worth trying the old create-a-blank-database-and-import-everything-into-it routine before doing anything else. Actually, might be worthwhile to first try deleting then re-creating the offending textbox.

                              Linq ;0)>

                              Comment

                              Working...