473,503 Members | 11,237 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Controls Flying?

77 New Member
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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtEmpIDATT_Exit(Cancel As Integer)
  2.     If txtEmpIDATT.Text = "" Then
  3.         'do nothing
  4.     Else
  5.         Call cmdHidden1_Click
  6.     End If
  7. End Sub
  8.  
  9. Private Sub cmdHidden1_Click()
  10.     On Error GoTo errr
  11.     Call conDB
  12.     EID = Trim(txtEmpIDATT.Text)
  13.     vSQL = "select emp_name,function from emp_master where emp_id=" & EID
  14.     Set rsMain = conMain.Execute(vSQL)
  15.     If rsMain.BOF = True Then
  16.         MsgBox "Either the Employee ID is incorrect or the employee doesn't exist in records.", vbCritical, "Employee ID"
  17.         Call att_reset
  18.     Else
  19.         txtEmpNameAtt.Caption = rsMain(0) & "/" & rsMain(1)
  20.         DTLWD.Enabled = True
  21.         DTDOA.Enabled = True
  22.         If rsMain(1) = "Attrition" Then
  23.             MsgBox "This employee has already attrited.", vbCritical, "Attrition"
  24.             Call att_reset
  25.         Else
  26.             'do nothing
  27.         End If
  28.     End If
  29.     Exit Sub
  30. errr:
  31.     MsgBox Err.Description
  32.     Set rsMain = Nothing
  33.     Set conMain = Nothing
  34. End Sub
  35.  
  36. Private Sub att_reset()
  37.     txtEmpIDATT.SetFocus
  38.     txtEmpIDATT.Text = ""
  39.     txtEmpNameAtt.Caption = ""
  40.     DTLWD.Enabled = False
  41.     DTDOA.Enabled = False
  42. End Sub
  43.  
  44.  
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
File Type: zip Flying.zip (17.6 KB, 109 views)
Sep 4 '08 #1
31 2084
Stewart Ross
2,545 Recognized Expert Moderator Specialist
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:

Expand|Select|Wrap|Line Numbers
  1. with Me![yourtextboxname]
  2.   msgbox("Left = " & .Left & " Top = " & .Top)
  3. 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
Sep 4 '08 #2
yaaara
77 New Member
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...

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:

Expand|Select|Wrap|Line Numbers
  1. with Me![yourtextboxname]
  2.   msgbox("Left = " & .Left & " Top = " & .Top)
  3. 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
Sep 4 '08 #3
yaaara
77 New Member
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?

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...
Sep 4 '08 #4
yaaara
77 New Member
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...



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?
Sep 4 '08 #5
Stewart Ross
2,545 Recognized Expert Moderator Specialist
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
Sep 4 '08 #6
yaaara
77 New Member
How can we find whether it is a known bug or something else?

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
Sep 4 '08 #7
Stewart Ross
2,545 Recognized Expert Moderator Specialist
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
Sep 4 '08 #8
yaaara
77 New Member
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 :-)

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
Sep 4 '08 #9
yaaara
77 New Member
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?

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 :-)
Sep 4 '08 #10
Stewart Ross
2,545 Recognized Expert Moderator Specialist
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
Sep 4 '08 #11
yaaara
77 New Member
Thanks a ton Stuart.. Any help will be highly appreciated :-)

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
Sep 4 '08 #12
nico5038
3,080 Recognized Expert Specialist
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:
http://support.microsoft.com/support.../Q109/9/53.asp
Jetcomp:
http://support.microsoft.com/default...;en-us;Q273956
and/or read the article:
ACC2000: How to Troubleshoot Corruption in a Microsoft Access Database
http://support.microsoft.com/default...b;en-us;306204
(Or look for similar info on 2003 when you use that)

4) Bit "heavier":
Access decompile:
http://www.granite.ab.ca/access/decompile.htm


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

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

Nic;o)
Sep 4 '08 #13
missinglinq
3,532 Recognized Expert Specialist
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)>
Sep 4 '08 #14
yaaara
77 New Member
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 :-(

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)>
Sep 4 '08 #15
nico5038
3,080 Recognized Expert Specialist
Then I would now try the Access decompile, or try to change the datepicker's dll/ocx to a (newer) verion.

Personally I never use this (and other .ocx) controls as it's making the running of the databaseon another PC dpending on the installed .dll's (they have a reason to call this the ".dll hell").

I use for datetime picking the control fro www.mvps.org/access and have a sample attached that's a stripped down version. As it's "all Access" the portability of the control is 100%.

Nic;o)
Attached Files
File Type: zip MiniCalendar2000.zip (17.5 KB, 95 views)
Sep 4 '08 #16
missinglinq
3,532 Recognized Expert Specialist
Nico's last post made me think about something; you've been calling this a "DatePicker" and we've been assuming that it's an ActiveX control, but is it in fact? I ask because there are custom made datepickers out there that position themselves in relation to the control they're going to populate, and I have heard of problems with them from time to time.

No one has asked, but would it be possible to zip your database up and post it here? This is really one of those times when actually having your hands on the app can make a big difference in troubleshooting it.

Linq ;0)>
Sep 4 '08 #17
FishVal
2,653 Recognized Expert Specialist
Hello, yaara.

Do you have a method to reproduce the fault?
If so (and even if you don't), then it may be a good idea to attach sanitized copy of db to the thread.

P.S. Are you sure your DTPickers are bound to the same background as TextBoxes are?

P.P.S. Also, please post library of DTPicker control - name, version, dll/ocx.
Sep 4 '08 #18
NeoPa
32,557 Recognized Expert Moderator MVP
I'm just leaving for home so am in a bit of a rush, but there was a call to arms from our revered leader so I will just pop in to suggest something you can try to help you discover what may be causing this anomaly. It is only really effective if it is due to your code, but the debugger (specifically Watch Pane - See Debugging in VBA for more details) has a facility to watch a value, and interrupt execution of the code when that changes for any reason.

I suggest you set up your database with this Watch set and see where the code stops.

Let me know how you get on with this.
Sep 4 '08 #19
missinglinq
3,532 Recognized Expert Specialist
Only 6:35 PM and already you're heading for home and hearth? I take it France's 35 hour work week hasn't made its way over the Channel yet!

;0)>
Sep 4 '08 #20
yaaara
77 New Member
The control indeed is the Microsoft Date and Time Picker control ver 6.0. It is the default DTPicker that I found in the Access Forms Toolbox List so I used it..

Zipping the database and posting here won't be possible as the database I'm referring to is a different .mdb file and my front end is in a different .mdb file. So If I post my front end, it won't work, and posting the DB would be difficult as it is approx 250+ MB... So not much luck there I guess..

Please let me know if anyone comes across with known issues with this DTPicker control...

Nico's last post made me think about something; you've been calling this a "DatePicker" and we've been assuming that it's an ActiveX control, but is it in fact? I ask because there are custom made datepickers out there that position themselves in relation to the control they're going to populate, and I have heard of problems with them from time to time.

No one has asked, but would it be possible to zip your database up and post it here? This is really one of those times when actually having your hands on the app can make a big difference in troubleshooting it.

Linq ;0)>
Sep 4 '08 #21
yaaara
77 New Member
As far as I know, the DTPickers are bound to the same Tab Control as the Text Boxes, but I'm not sure.. may be they're not? How can I check and make sure that they are? Also, I'd say that even if they are not (let's assume), then ideally they should not change their positions on their own... and that too at random times? That seems wierd, isn't it? But still, if bounding the controls to the Tab Control helps, I'd like to check it out... So pls let me know how to check it and how to make sure that all controls are bound to the same Tab Control...

Thanks :-)

Hello, yaara.

Do you have a method to reproduce the fault?
If so (and even if you don't), then it may be a good idea to attach sanitized copy of db to the thread.

P.S. Are you sure your DTPickers are bound to the same background as TextBoxes are?

P.P.S. Also, please post library of DTPicker control - name, version, dll/ocx.
Sep 4 '08 #22
NeoPa
32,557 Recognized Expert Moderator MVP
Only 6:35 PM and already you're heading for home and hearth? I take it France's 35 hour work week hasn't made its way over the Channel yet!

;0)>
7 hour working day - That would be nice :D
Sep 4 '08 #23
Stewart Ross
2,545 Recognized Expert Moderator Specialist
A big thank you to all my forum colleagues for responding so timeously and helpfully here - you've really helped focus this thread in to what may well be the nub of the problem - interactions of the datepicker controls in some way.

Ever been told you're a great team to work with? I learn a lot from you all even now.

Geesh, gotta go or I'll get even more slushy...

Cheers guys

-Stew
Sep 4 '08 #24
sam12
16 New Member
Hi yaara
I was having the same problem with datepicker
I finally gave up and used a new form "calendar" to do this

Here is the link to see how it works
http://rapidshare.com/files/143939578/calendar.rar.html
It has two modules
one is for calendar and other is to change the cursor type when u go on the calendar icon
If u wana use this, Import these 2 modules and one form calendar in ur db
and u have the coding how to call it
Sep 4 '08 #25
NeoPa
32,557 Recognized Expert Moderator MVP
Sam,

I tried your link and, whether the pop-up would have directed me to a download I don't know, but with pop-ups blocked I was only able to see the sign-up page of that site which is not a valid link (which I have removed).

Please, if you have helpful software to share, consider posting it in the thread. Attachments are also available if the size is not too great.

Administrator.
Sep 4 '08 #26
yaaara
77 New Member
So apparantly, this is a problem with Datepicker?
Sep 5 '08 #27
NeoPa
32,557 Recognized Expert Moderator MVP
Only you would know at this stage Yaaara. Have you tried the debugging (Watch Window) technique I suggested (post #19)?
Sep 5 '08 #28
yaaara
77 New Member
Sorry but not sure how to setup the watch window for this Neo :-(

Pls assist...
Sep 5 '08 #29
NeoPa
32,557 Recognized Expert Moderator MVP
On one condition :- You stop including quotes of the previous post unless they are relevant. Generally not when your post follows on immediately afterwards. It's only really necessary to indicate a break in flow of the thread, or to draw particular attention to an item as you respond to it.

Anyway - on to the instructions.
  1. Find a value that will change when the item moves. This can be .Top or .Left of the item that moves.
  2. Using Alt-V+H, open the Watch Pane.
  3. Right click within it to add a new watch expression.
  4. Enter the full object address of the .Top or .Left item you're trying to monitor into Expression.
  5. In Procedure & Module select all.
  6. In Watch Type select Break When value Changes
Run the code until the item moves. At this point the code should break leaving you where (or at least near) the point where something strange is happening.

Have fun :)
Sep 5 '08 #30
NeoPa
32,557 Recognized Expert Moderator MVP
Hi yaara
I was having the same problem with datepicker
I finally gave up and used a new form "calendar" to do this

Here is the link to see how it works
http://rapidshare.com/files/143939578/calendar.rar.html
It has two modules
one is for calendar and other is to change the cursor type when u go on the calendar icon
If u wana use this, Import these 2 modules and one form calendar in ur db
and u have the coding how to call it
Sam12 supplied me with a new (working) version of the link which I have inserted back into his post.

Check it out.
Sep 9 '08 #31
nico5038
3,080 Recognized Expert Specialist
Hmm, just another thought, did you check how many date-time controls there are on your form. Are you sure it's no "hidden" control on the top of the form or "behind" the tab control that's "popping" up ?
It's often hard to see, but best to check or, after removing the two visible combo's, this behavior persists.

Nic;o)
Sep 11 '08 #32

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1752
by: aler45dcom | last post by:
I write a flying text script,but it sinks at the bottom and it stays there forever. How to change it so that it flies in the webpage? <html> <head> <title>Flying text</title> <script...
2
3754
by: Nick | last post by:
What I want to do is have 2 pull down lists, for example a state pull down list and a city pull down list. What I would like to have done is when you select a state from the state pull down list...
4
1590
by: ad | last post by:
I am using VS2005 to develp Win form program. I add lines to a ListBox. But when the line width larger than the width of the ListBox, the ListBox can't wrap the word. What conrols is suittable...
6
2659
by: ad | last post by:
I want to limin the length of password must larger than 6. How can I do with Login Controls of asp.net 2.0
0
7194
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
7070
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
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6976
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
5566
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
4993
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
1495
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 ...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
372
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.