I have a situation where I have a checkbox that is supposed to check if one of two criteria happens.
I can get it to check if one of the criteria is true but I'm having issues having it check if the other is.
So if one of the two cases below is true the chkSizeableUpcharge checkbox should be checked. But what's happening is that it's only checking the box if the txtDoorWidth option triggers it. It's ignoring the height, which I'm guessing is because it checks the width later, but I need it to do it based on either of them, like an Or in between but not sure how to write it. Any ideas or help would be appreciated. - Select Case frm.TxtDoorHt.Value
-
-
Case 78, 84, 90, 96, 102, 108
-
frm.chkSizeableUpcharge.Value = False
-
Else
-
frm.chkSizeableUpcharge.Value = True
-
End Select
-
-
'Only valid door widths - 8, 9, 10, 12, 16, 18
-
Select Case frm.TxtDoorWidth.Value
-
-
Case 96, 108, 120, 144, 192, 216
-
frm.chkSizeableUpcharge.Value = False
-
Case Else
-
frm.chkSizeableUpcharge.Value = True
-
-
End Select
8 1237
That's because your else option in your second select is going to override whatever the first select did. What you'll want to do is nest your selects.
Thank you, I understand what you're saying but when I try and nest them the way that I think that would normally work with a If Then Else scenario, it doesn't work, it still will check the box when the height is non-standard if I put height first when I nest it, than it will check the box for the height if it's wrong but not for the width if it's wrong and the height is ok. Same if I swap them, it will do the width but not the height.
I know I'm probably nesting it wrong, so any guidance would be appreciated. I have had to pick up this programming thing on my own, and this program has a ton of code in it.
My attempt based on what I think you said is below. - Select Case frm.TxtDoorHt.Value
-
-
Case 78, 84, 90, 96, 102, 108
-
frm.chkSizeableUpcharge.Value = False
-
-
Select Case frm.TxtDoorWidth.Value
-
Case 96, 108, 120, 144, 192, 216
-
frm.chkSizeableUpcharge.Value = False
-
End Select
-
-
Case Else
-
frm.chkSizeableUpcharge.Value = True
-
-
End Select
You nested it in the wrong place. It needs to be nested in the the Else.
Thank you for the clarification. I redid it per the below but now both of them have to be true in order to trigger the check box instead of either of them being true.
I changed the code, I hope in the proper way per your instruction to the below. Do you have any further ideas? - Select Case frm.TxtDoorHt.Value
-
-
Case 78, 84, 90, 96, 102, 108
-
frm.chkSizeableUpcharge.Value = False
-
-
Case Else
-
Select Case frm.TxtDoorWidth.Value
-
Case 96, 108, 120, 144, 192, 216
-
frm.chkSizeableUpcharge.Value = False
-
Case Else
-
frm.chkSizeableUpcharge.Value = True
-
End Select
-
-
-
End Select
Sorry, I didn't notice the way you were setting your true/false. You can either flip your conditions or use your first nested example and include an else statement.
Hey mayala12, in your first code put your second select case statement inside a if statement only if frm.chkSizeableUpcharge.Value is False. i.e., After first select case statement still if chkSizeableUpcharge CheckBox is not checked then execute your second select case statement.
Thank you everyone for your help. I think I have solved this after thinking about it. There is another place in the code where we are doing something similar that I found. I have sort of copied that idea and below is what I came up with and it seems to be working. The feedback was helpful in working through different scenarios and figuring out why it wasn't working etc. - Select Case frm.TxtDoorHt.Value
-
-
Case 78, 84, 90, 96, 102, 108
-
bSizeableHtChk = False
-
Case Else
-
bSizeableHtChk = True
-
-
End Select
-
-
Select Case frm.TxtDoorWidth.Value
-
Case 96, 108, 120, 144, 192, 216
-
bSizeableWdthChk = False
-
Case Else
-
bSizeableWdthChk = True
-
End Select
-
-
If bSizeableHtChk = True And bSizeableWdthChk = True Then
-
frm.chkSizeableUpcharge.Value = True
-
ElseIf bSizeableHtChk = True And bSizeableWdthChk = False Then
-
frm.chkSizeableUpcharge.Value = True
-
ElseIf bSizeableHtChk = False And bSizeableWdthChk = True Then
-
frm.chkSizeableUpcharge.Value = True
-
Else
-
frm.chkSizeableUpcharge.Value = False
-
End If
Hey mayala12, its sounds good. You found a way to solve your problem by yourself. If you want then still you can optimize your code. -
If bSizeableHtChk = False And bSizeableWdthChk = False Then
-
frm.chkSizeableUpcharge.Value = False
-
Else
-
frm.chkSizeableUpcharge.Value = True
-
End If
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ben Willcox |
last post by:
Hi I am having difficulty writing an SQL query to do what I want:
I have 1 table with 2 columns, 'id' and 'name':
tbl_names:
id name
-- ----
1 Bob
2 Jeff
3 Fred
|
by: mark.reichman |
last post by:
First off.. Thanks to Grant Wagner for help in a previous thread
related to this one.
I am at a total loss... I have multiple fields in a form with the
same name. Lets call the fields with the...
|
by: tesc |
last post by:
I am so aggravated and need any help I can get. I am using Access 2000
and am trying to sort multiple fields in a select query.
My query is set up as follows:
FIELD 1 FIELD 2 FIELD 3 ...
|
by: JP SIngh |
last post by:
Hi All
This is a complicated one, not for the faint hearted :) :) :)
Please help if you can how to achieve this search.
We have a freetext search entry box to allow users to search the...
|
by: mkjets |
last post by:
I have worked for hours on trying to find a solution and have not
figured it out. I am working in Access 2003. I need to create a query
that takes values from 1 table and displays them in...
|
by: 4Him |
last post by:
First off, let me say this is a great site! I've just started working with Access and much of my success is from what I've read here!
Background: I have a form, driven off a single table.
Goal:...
|
by: Max |
last post by:
Is there any way to set a select-multiple type <select
multiple="multiple"with multiple selected options in scripting?
Any idea about this is appreciative.
|
by: Nathan Sokalski |
last post by:
I have a Repeater that uses a DataSource that has multiple fields. When the
values of these fields is displayed in the Repeater, there are fields that
are used in combination with other fields as...
|
by: john.cole |
last post by:
I have searched all the groups I can, and I still haven't been able to
come up the solution I need. I have the following problem.
In my form named sbfrmSpoolList, I am entering a job, spool and...
|
by: bonneylake |
last post by:
Hey Everyone,
Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place.
...
|
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,...
|
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$) {
}
...
|
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: 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...
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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: 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...
| |