473,386 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

changing properties seems 'invisible' in subprocedure

Can anyone explain this strange behavior?

On an access form (access 2010), I have a line to change the enabled property in the "on_click()" event which disables the command button. The exact code is me!cmdaddNew.enabled=false. This does fine to disable the button. However, in the onexit() event for the same command button, I put a line(as shown below) to restore the status of the button to true. I have written some extra code that adjusts some unbound text boxes on the form which look like this:

Expand|Select|Wrap|Line Numbers
  1. Me!txtcheckNumber = ""
  2. Me!txtpaymentAmt = Default
  3. Me!chkpaymentLate = 0
  4. Me!txtpaymentDate = Date
  5. Me!cmdaddNew.enabled=true
All of the code executes fine EXCEPT FOR re-enabling the command button. It compiles fine and executes with no run-time error messages, but it seems to completely ignore the one line of code to restore the enabled property. Just to be as clear as possible, the onclick() event also updates tables with a recordset object which works fine. I am still not really adept enough with debugging tools for them to be a lot of assistance. Any reply (or suggestion) would be greatly appreciated!
Jul 27 '14 #1
3 1006
twinnyfo
3,653 Expert Mod 2GB
Have you tried inserting a breakpoint in your code and gone through line by line when it executes (F8)? This would tell you if the code is actually trying to enable the control or if it just "appears that the other code is running and omitting this one line.
Jul 28 '14 #2
I believe that I will try to use some 'breakpoint' techniques to debug this issue. I suspect that it is not a good idea (in general) to disable the current command button in an onexit() subprocedure, and then try to reset this with another 'focus' event. I even tried to 'reinstate' the enabled property of the button through a general form click() event, and this doesn't work. Since all of my textboxes to update data are unbound, this might add another complication if I try to invoke the re-enabling through a form after update() event. There must be a general coding process which does this in a fairly routine way. It would seem to be some functionality that anyone would wish to have on a form with a command button. Thank you for the advice and I still would appreciate any and all suggestions on this matter.
Jul 28 '14 #3
zmbd
5,501 Expert Mod 4TB
When you set your
Expand|Select|Wrap|Line Numbers
  1. stop
do so at the start of your onclick event.

What you are goint to see is that as soon as you "disable" the command button, the onexit event triggers... you have in effect, left the command button at that point.

It's all in the timing... watch as I pull a Rabbit, err, Frog, err, Hamster... there it is, out of the Hat. (^_^)
Jul 28 '14 #4

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

Similar topics

2
by: Edd | last post by:
I have a VB App that instantiates a Access Application from which I have triggered the running of reports using the standard DoCmd.OperReport. This is an automated printing app that just reads...
4
by: Tony W | last post by:
Hi, I am trying to write a simple application to retrieve data from the Windows registry and insert it into textboxs on a windows form. So far I have one namespace containing two classess. ...
1
by: Tobe | last post by:
We want to change the autopostback properties (serverside) of all of the dropdownlistboxes on the page. I am trying to loop through the Request.Form.Items, but I can't seem to get more the the...
2
by: | last post by:
Hi, I've written a web server custom control. If it's attributes are set at design time in the HTML it works fine. But I want to also be able to dynamically change some of the properties in...
12
by: Nico Schuyt | last post by:
Maybe a stupid question (I'm not so familiar with javascript), but: I want to change background of a paragraph or list item on mouseover. The following code works: <p...
0
by: Yeti | last post by:
Hey everyone..I have no idea why this is happening..its so weird. I am trying to change the backcolor of a panel when a textbox changes value. The code is as follows: Private Sub...
5
by: g6023 | last post by:
Hi All Newbie to C# I am afraid The array of panel dispays OK but I am having problems with accessing the controls within. My panels each have a number of label controls. How do I set, say,...
1
by: libsfan01 | last post by:
hi all! i want to change the properties of a div tag within an iframe embedded in my page how can i do that? regards marc
3
by: Sagaert Johan | last post by:
Hi I have a custom control that displays an image. I have the invalidate method fired when a new picture is selected in the designer, but the designer does not show this change. It only does...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...

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.