473,396 Members | 2,016 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,396 software developers and data experts.

Check box on a form

84
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?
Apr 26 '07 #1
7 3724
ADezii
8,834 Expert 8TB
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.
Expand|Select|Wrap|Line Numbers
  1. 'If chkStatus is checked, IIF returns the value in the Status1 Field
  2. 'on the Account Records Form - if it is not checked, an empty String is
  3. 'returned.
  4.  
  5. IIf(Me![chkStatus], [Forms}![Account Records]![Status1], "")
Apr 26 '07 #2
sesling
84
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.
Expand|Select|Wrap|Line Numbers
  1. 'If chkStatus is checked, IIF returns the value in the Status1 Field
  2. 'on the Account Records Form - if it is not checked, an empty String is
  3. 'returned.
  4.  
  5. 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?
Apr 27 '07 #3
ADezii
8,834 Expert 8TB
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.
Apr 27 '07 #4
sesling
84
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.
Apr 29 '07 #5
ADezii
8,834 Expert 8TB
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.
Expand|Select|Wrap|Line Numbers
  1. Dim strStatus As String
  2.  
  3. If Me![chkOpen] And Me![chkClosed] And Me![chkPending] Then
  4.   strStatus = " IN('Open', 'Closed', 'Pending');"
  5. ElseIf Me![chkOpen] And Me![chkClosed] Then
  6.   strStatus = " IN('Open', 'Closed');"
  7. ElseIf Me![chkPending] And Me![chkClosed] Then
  8.   strStatus = " IN('Pending', 'Closed');"
  9. ElseIf Me![chkOpen] And Me![chkPending] Then
  10.   strStatus = " IN('Open', 'Pending');"
  11. ElseIf Me![chkOpen] Then
  12.   'keep the syntax the same
  13.   strStatus = " IN('Open');"
  14. ElseIf Me![chkClosed] Then
  15.   strStatus = " IN('Closed');"
  16. ElseIf Me![chkPending] Then
  17.   strStatus = " IN('Pending');"
  18. Else    'No Check Box has been selected
  19.   strStatus = " NOT IN('Open', 'Closed', 'Pending');"
  20. End If
  21.  
  22. "SELECT DETAIL_COUNT, RECORD_COUNT, STATUS
  23. FROM LOGICAL_FILE
  24. WHERE LOGICAL_FILE.STATUS " & strStatus
  25.  
Apr 29 '07 #6
sesling
84
Expand|Select|Wrap|Line Numbers
  1. Dim strStatus As String
  2.  
  3. If Me![chkOpen] And Me![chkClosed] And Me![chkPending] Then
  4.   strStatus = " IN('Open', 'Closed', 'Pending');"
  5. ElseIf Me![chkOpen] And Me![chkClosed] Then
  6.   strStatus = " IN('Open', 'Closed');"
  7. ElseIf Me![chkPending] And Me![chkClosed] Then
  8.   strStatus = " IN('Pending', 'Closed');"
  9. ElseIf Me![chkOpen] And Me![chkPending] Then
  10.   strStatus = " IN('Open', 'Pending');"
  11. ElseIf Me![chkOpen] Then
  12.   'keep the syntax the same
  13.   strStatus = " IN('Open');"
  14. ElseIf Me![chkClosed] Then
  15.   strStatus = " IN('Closed');"
  16. ElseIf Me![chkPending] Then
  17.   strStatus = " IN('Pending');"
  18. Else    'No Check Box has been selected
  19.   strStatus = " NOT IN('Open', 'Closed', 'Pending');"
  20. End If
  21.  
  22. "SELECT DETAIL_COUNT, RECORD_COUNT, STATUS
  23. FROM LOGICAL_FILE
  24. WHERE LOGICAL_FILE.STATUS " & strStatus
  25.  
Got it now. Thx for the help.
Apr 30 '07 #7
ADezii
8,834 Expert 8TB
Got it now. Thx for the help.
You're quite welcome.
Apr 30 '07 #8

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

Similar topics

17
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...
0
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...
2
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>...
5
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...
15
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...
5
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
1
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...
14
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...
3
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...
5
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
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
Oralloy
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,...
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...
0
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
tracyyun
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...

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.