I have several text boxes on a form that are populated with certain values depending on the value chosen on a combo box. These textboxes are populated with currency values with help of macros. Problem is that I also have a check box that when checked must populate the last textbox with a value of "0" and disregard the value assigned by macro, but only when checked. If the user unchecks the box then the macro must run and assign its value. The first part works fine. When the checkbox is checked it assigns "0", but when it is unchecked it returns and Action Failed on the macro. How can i make this work? I hope i have made myself clear. What i have so far this on the after update on the checkbox:
If Me.EXEMPTED_DEDUCTION.Value = True Then
Me.DEDUCTIONS.Value = 0
Else
DoCmd.RunMacro "McrDefaultValue"
End If
End Sub
4 2576
I have several text boxes on a form that are populated with certain values depending on the value chosen on a combo box. These textboxes are populated with currency values with help of macros. Problem is that I also have a check box that when checked must populate the last textbox with a value of "0" and disregard the value assigned by macro, but only when checked. If the user unchecks the box then the macro must run and assign its value. The first part works fine. When the checkbox is checked it assigns "0", but when it is unchecked it returns and Action Failed on the macro. How can i make this work? I hope i have made myself clear. What i have so far this on the after update on the checkbox:
If Me.EXEMPTED_DEDUCTION.Value = True Then
Me.DEDUCTIONS.Value = 0
Else
DoCmd.RunMacro "McrDefaultValue"
End If
End Sub
Can you please post what is in the Macro as well?
This will help in troubleshooting your problem.
The obvious comment that I have so far is use the OnChange Event instead of the AfterUpdate event. The onChange Event fires right as you change it. not after the record is updated. This may be to late for what you're wanting to accomplish.
Write me back on the forum and let me know once you have the macro posted.
Thanks,
Joe P.
Thank you! It worked! I changed it to the on change event and it worked wonderfully!
I'm glad that you got it working, but there's absolutely no reason why it shouldn't have worked in the checkbox's AfterUpdate event! A control's AfterUpdate fires before the record is saved, while the record is still Dirty. For a textbox, this occurs when the focus leaves the textbox for another control. For a checkbox the AfterUpdate fires as soon as it's checked/unchecked.
There's another problem that you haven't addressed, at least not here. If the user checks the box, zero is assigned. If they then uncheck the box, the textbox is populated by your macro. But what happens if the user simply does nothing with the checkbox? How is the textbox populated then?
Linq ;0)>
I'm glad that you got it working, but there's absolutely no reason why it shouldn't have worked in the checkbox's AfterUpdate event! A control's AfterUpdate fires before the record is saved, while the record is still Dirty. For a textbox, this occurs when the focus leaves the textbox for another control. For a checkbox the AfterUpdate fires as soon as it's checked/unchecked.
There's another problem that you haven't addressed, at least not here. If the user checks the box, zero is assigned. If they then uncheck the box, the textbox is populated by your macro. But what happens if the user simply does nothing with the checkbox? How is the textbox populated then?
Linq ;0)>
i have another macro populating this texbox when the checkbox is not checked. It is doing exactly what i need it to do! Many Thanks!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Pete |
last post by:
There is a Summary/Example further down...
On page one of my site I have a form with some checkboxes and detailed
descriptions. When the form is submitted (to page two), the values of
the...
|
by: terence.parker |
last post by:
I currently have the following JS in my header:
function checkall(thestate) {
var checkboxes=eval("document.forms.EssayList.file_id")
for (i=0;i<checkboxes.length;i++)...
|
by: Krumble Bunk |
last post by:
Hello!
First things first (but not necessarily in that order), this is a
really great group, and has helped me understand more and more C
everytime I read the postings, so thanks for a great...
|
by: Carl Griffin |
last post by:
I am working an an application to enumerate users and permissions
they have to read certain fax queues on a fax server. The problem I am
having is that I can't figure out a way to let the admin...
|
by: rn5a |
last post by:
All the rows in a DataGrid, including the Header, are accompanied with
a CheckBox. I want that when the CheckBox in the Header is checked,
then all the CheckBoxes should automatically get checked....
|
by: masterej |
last post by:
Developers,
Is there any way to disable all checkboxes on a form? I have a form
with 160 checkboxes and I want to be able to disable all of them. Is
there a way I can do something like this:
...
|
by: lindabaldwin |
last post by:
Hello all,
I am fairly new to VBA and have had limited work with checkboxes before. I have turned an Excel worksheet into a form in which users can enter data and click checkboxes. I want to...
|
by: PeteOlcott |
last post by:
http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/test_change_structure.html
I would like to completely understand how GUI controls such as this
one are constructed. In the...
|
by: viki1967 |
last post by:
I need one function javascript that:
1) when I enter in this htm page I see enabled only checkbox of categories A, M and T; checkboxes of microcategories all disabled;
2-a) If I select the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |