Currently I am using 3 text boxes (status1, status2, status3) on a form and passing the values to a query. The operator will enter one of three statuses (Open, Closed, Pending) in one or more text boxes. The operator will execute a query and the results will be returned based on what they enter. Below I have listed the criteria statement from the query.
[forms}![Account Records]![status1] or [forms}![Account Records]![status2] or [forms}![Account Records]![status3]
I know I can default values in the box and have the operator either keep or remove them to change the results of the query.
However, we will be adding more statuses to our table. Instead of the operator entering the value I would like to use a check box so when the operator selects the box a value will be passed to the query. If the box is not selected the value will not be passed to the query. Is this possbile?
7 3724
Currently I am using 3 text boxes (status1, status2, status3) on a form and passing the values to a query. The operator will enter one of three statuses (Open, Closed, Pending) in one or more text boxes. The operator will execute a query and the results will be returned based on what they enter. Below I have listed the criteria statement from the query.
[forms}![Account Records]![status1] or [forms}![Account Records]![status2] or [forms}![Account Records]![status3]
I know I can default values in the box and have the operator either keep or remove them to change the results of the query.
However, we will be adding more statuses to our table. Instead of the operator entering the value I would like to use a check box so when the operator selects the box a value will be passed to the query. If the box is not selected the value will not be passed to the query. Is this possbile?
I am definately not an advocate of the IIF() Function, but it seems appropriate under this circumstance. Hopefully, this will point you in the right direction. - 'If chkStatus is checked, IIF returns the value in the Status1 Field
-
'on the Account Records Form - if it is not checked, an empty String is
-
'returned.
-
-
IIf(Me![chkStatus], [Forms}![Account Records]![Status1], "")
I am definately not an advocate of the IIF() Function, but it seems appropriate under this circumstance. Hopefully, this will point you in the right direction. - 'If chkStatus is checked, IIF returns the value in the Status1 Field
-
'on the Account Records Form - if it is not checked, an empty String is
-
'returned.
-
-
IIf(Me![chkStatus], [Forms}![Account Records]![Status1], "")
I think it will work. Where would the IIF statement go? Would that be in the criteria field of the query?
I think it will work. Where would the IIF statement go? Would that be in the criteria field of the query?
Within the built up SQL statement.
Within the built up SQL statement.
Sorry I am new to Access and I am not clear where the statement would go. Let me provide some more detail to see if this will help us locate the location.
1) I have a form called File Summary. On this form is where the operator can select the file status. Again I am using text boxes to pass this information to a query. Text Box names are [Status1], [Status2], [Status3]
2) The query name is File List - Status. The criteria of this query currently uses the data selected on the form File Summary. Here is the query statement
SELECT DETAIL_COUNT, RECORD_COUNT, STATUS
FROM LOGICAL_FILE
WHERE LOGICAL_FILE.STATUS=[FORMS]![FILE SUMMARY]![STATUS1]OR LOGICAL_FILE.STATUS=[FORMS]![FILE SUMMARY]![STATUS2]
or LOGICAL_FILE.STATUS=[FORMS]![FILE SUMMARY]![STATUS3];
3). The operator will select a Command button on the File Summary form that will open another form that uses the File List - Status query as its row source.
The goal is to change the text boxes to a check boxes. This way the operator would select the check box for the status they want to pass to the query.
Sorry I am new to Access and I am not clear where the statement would go. Let me provide some more detail to see if this will help us locate the location.
1) I have a form called File Summary. On this form is where the operator can select the file status. Again I am using text boxes to pass this information to a query. Text Box names are [Status1], [Status2], [Status3]
2) The query name is File List - Status. The criteria of this query currently uses the data selected on the form File Summary. Here is the query statement
SELECT DETAIL_COUNT, RECORD_COUNT, STATUS
FROM LOGICAL_FILE
WHERE LOGICAL_FILE.STATUS=[FORMS]![FILE SUMMARY]![STATUS1]OR LOGICAL_FILE.STATUS=[FORMS]![FILE SUMMARY]![STATUS2]
or LOGICAL_FILE.STATUS=[FORMS]![FILE SUMMARY]![STATUS3];
3). The operator will select a Command button on the File Summary form that will open another form that uses the File List - Status query as its row source.
The goal is to change the text boxes to a check boxes. This way the operator would select the check box for the status they want to pass to the query.
- Dim strStatus As String
-
-
If Me![chkOpen] And Me![chkClosed] And Me![chkPending] Then
-
strStatus = " IN('Open', 'Closed', 'Pending');"
-
ElseIf Me![chkOpen] And Me![chkClosed] Then
-
strStatus = " IN('Open', 'Closed');"
-
ElseIf Me![chkPending] And Me![chkClosed] Then
-
strStatus = " IN('Pending', 'Closed');"
-
ElseIf Me![chkOpen] And Me![chkPending] Then
-
strStatus = " IN('Open', 'Pending');"
-
ElseIf Me![chkOpen] Then
-
'keep the syntax the same
-
strStatus = " IN('Open');"
-
ElseIf Me![chkClosed] Then
-
strStatus = " IN('Closed');"
-
ElseIf Me![chkPending] Then
-
strStatus = " IN('Pending');"
-
Else 'No Check Box has been selected
-
strStatus = " NOT IN('Open', 'Closed', 'Pending');"
-
End If
-
- "SELECT DETAIL_COUNT, RECORD_COUNT, STATUS
-
FROM LOGICAL_FILE
-
WHERE LOGICAL_FILE.STATUS " & strStatus
-
- Dim strStatus As String
-
-
If Me![chkOpen] And Me![chkClosed] And Me![chkPending] Then
-
strStatus = " IN('Open', 'Closed', 'Pending');"
-
ElseIf Me![chkOpen] And Me![chkClosed] Then
-
strStatus = " IN('Open', 'Closed');"
-
ElseIf Me![chkPending] And Me![chkClosed] Then
-
strStatus = " IN('Pending', 'Closed');"
-
ElseIf Me![chkOpen] And Me![chkPending] Then
-
strStatus = " IN('Open', 'Pending');"
-
ElseIf Me![chkOpen] Then
-
'keep the syntax the same
-
strStatus = " IN('Open');"
-
ElseIf Me![chkClosed] Then
-
strStatus = " IN('Closed');"
-
ElseIf Me![chkPending] Then
-
strStatus = " IN('Pending');"
-
Else 'No Check Box has been selected
-
strStatus = " NOT IN('Open', 'Closed', 'Pending');"
-
End If
-
- "SELECT DETAIL_COUNT, RECORD_COUNT, STATUS
-
FROM LOGICAL_FILE
-
WHERE LOGICAL_FILE.STATUS " & strStatus
-
Got it now. Thx for the help.
Got it now. Thx for the help.
You're quite welcome.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dave Smithz |
last post by:
Hi there,
A PHP application I built has a section which lists a number of members to a
club whose names each appear with a check box beside them that can be
ticked.
These check boxes are part...
|
by: Dakanali |
last post by:
I have a previous form which user search if there is a domain name. Give the
domain name and in xml send the data from
domainName=rewuest.form("domainname") to the specify url which is below and i...
|
by: Edward |
last post by:
The following html / javascript code produces a simple form with check
boxes. There is also a checkbox that 'checks all' form checkboxes
hotmail style:
<html>
<head>
<title></title>
</head>...
|
by: Steve Wylie |
last post by:
I am constructing an HTML questionnaire and one of the questions
requires people to rate some choices from 1 to 5, where 1 is their
favourite and 5 is their least favourite:
Car
Bus
Taxi cab...
|
by: Rey |
last post by:
Howdy all.
Appreciate your help with several problems I'm having:
I'm trying to determine if the Visit subform (subformVisits) has a new
record or been changed, i.e. dirty. The form that...
|
by: rob willaar |
last post by:
Hi,
How can i check is a form is disposed in framework 1.1
In framework 2.0 i can check Form.IsDisposed to check if a user closed the
form
|
by: scprosportsman |
last post by:
Please help guys, i am trying to set up a database here at work and im
fairly new to access in terms of writing functions and queries and
stuff. I have 2 different places on my design that will...
|
by: Ørjan Langbakk |
last post by:
I have a form where the user has the possibility to enclose his name.
email, address and phonenumber.
I want to be able to check if some of the fields are filled - at least
one. This is so that...
|
by: jsurkin |
last post by:
I have a form that lists a single work request, with an attached
continuous subform that lists specific items that are part of the
request. Each item in the subform has a check box to indicate when...
|
by: Andrew Meador |
last post by:
I have a form (Change Card List by Status) with a check box
(cboNOT) and a list box (lstStatus). There is an Open Report button
that opens a report (Report - Change Card List) which uses a query...
|
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:
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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: 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: 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...
|
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...
| |