473,471 Members | 2,175 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Check boxes excludes needed information

5 New Member
Hello,

I am creating a form in Access that uses the days of the week (I am looking at flight patterns for an airline). I have created a check box for each day; therefore I have 7 total. The checkboxes relate back to a query (that are in the yes "-1" and no "0" format) so that when I check the box for Monday, the query comes back with flights that ONLY operate on Monday ("yes").

This is where my problem lies: what seems to be happening is when I check "Monday" and leave the rest unchecked, they are being recognized as "no" and therefore my query is returning only the results that have the pattern:
Mon: Yes
Tues: No
Wed: No
Thurs: No
Fri: No
Sat: No
Sun: No

Is there a way to make it so that when I check Monday, that it returns ANY data that has yes in Monday regardless of what the other days are? In other words, so it follows a pattern similar to this:
Mon: Yes
Tues: Yes OR No
Wed: Yes OR No
Thurs: Yes OR No
Fri: Yes OR No
Sat: Yes OR No
Sun: Yes OR No

Basically, I want to say if the box if checked then the value is -1 or yes, but if it is unchecked then the value is -1 (yes) OR 0 (no).

I am very new to Access, so I apologize if none of this makes any sense. I appreciate any help anyone can offer. I'm willing to try anything at this point!

JPG4
Aug 15 '07 #1
6 1299
Scott Price
1,384 Recognized Expert Top Contributor
Hello JPG4 and welcome to TSDN!

Could you post your current SQL code for us? Go to the query design view, right-click on the top of the design view window, choose SQL view, then copy and paste it over here... Once you have pasted it, wrap it with the code tags, by selecting it all, then clicking the # button on the top of this forums' reply window. Manually edit the first [code] tag to look exactly like this: [code=sql]... Thanks!

Regards,
Scott
Aug 15 '07 #2
JPG4
5 New Member
Hi Scott!

Thank you for a quick reply! I have copied and pasted the code below as you requested. (By the way, thank you for explaining how to do that... I would have been lost!) I have 4 queries total, but this it the final one (the one that relates back to the check boxes on the form). Let me know if you need anything else and again, thank you for your help!

Expand|Select|Wrap|Line Numbers
  1. SELECT [FREQ YesNo].MONTH, [FREQ YesNo].CXR, [FREQ YesNo].DEPT, [FREQ YesNo].ARR, [FREQ YesNo].STAGE, [FREQ YesNo].FLT, [FREQ YesNo].EQUIP, [FREQ YesNo].CAP, [FREQ YesNo].[D-TIME], [FREQ YesNo].[A-TIME], [FREQ YesNo].BLOCK, [FREQ YesNo].FREQ, [FREQ YesNo].Mon, [FREQ YesNo].Tues, [FREQ YesNo].Wed, [FREQ YesNo].Thurs, [FREQ YesNo].Fri, [FREQ YesNo].Sat, [FREQ YesNo].Sun
  2. FROM [FREQ YesNo]
  3. WHERE ((([FREQ YesNo].Mon)=[Forms]![OAG]![Mon1]) AND (([FREQ YesNo].Tues)=[Forms]![OAG]![tues1]) AND (([FREQ YesNo].Wed)=[Forms]![OAG]![wed1]) AND (([FREQ YesNo].Thurs)=[Forms]![OAG]![thurs1]) AND (([FREQ YesNo].Fri)=[Forms]![OAG]![fri1]) AND (([FREQ YesNo].Sat)=[Forms]![OAG]![sat1]) AND (([FREQ YesNo].Sun)=[Forms]![OAG]![sun1]));
Aug 15 '07 #3
Scott Price
1,384 Recognized Expert Top Contributor
Thanks for posting the SQL! You're welcome for the explanation! It's not always easy to tell if someone knows how already, so I err on the side of caution :-)

First thought, why not change your 7 fields in the FREQ YesNo table to one field named something like DayOfWeek. If I'm not mistaken, most of the time you will enter data for which flight runs when and where in this way: Mon - Thurs, Mon, Weds, Fri, etc? The SQL then for choosing ANY flight that operates on Monday will be like this:
Expand|Select|Wrap|Line Numbers
  1. SELECT [FREQ YesNo].FreqID, [FREQ YesNo].CXR, [FREQ YesNo].DayOfWeek
  2. FROM [FREQ YesNo]
  3. WHERE ((([FREQ YesNo].DayOfWeek) Like ("*Mon*")));
I tested this in my test db and it works perfectly, finding the four test records I entered with this form: Mon - Thurs ; Mon, Weds, Fri ; Mon ; Mon - Fri

Let me know what you think on this suggestion!

Regards,
Scott
Aug 15 '07 #4
JPG4
5 New Member
Scott,

I like your idea, however, I am not quite sure how to implement it. See, the days of the week (frequency) come from a table that is downloaded from a website into Excel and the uploaded into Access. The way the table comes is in numbers, where 1=Mon, 2=Tues, etc. The table comes with the frequencies all listed in one column in this format: 1..4.67 (Mon, Thurs, Sat, Sun), or 1...... (Only Monday), etc... So, what I did was set up a query to separate them out into 7 different columns, and then did another query that contained an IIF statement that changed them into Yes/No as opposed to numbers and periods.

If I go back to how the data originally comes (12..5.7), and I type in "Like "*1*" in the criteria, you are correct, it works perfectly! So the next step is how do I link this back to the form's check boxes so that when I check Monday it means "Like "*1*" as opposed to "Yes" for Monday?

Thanks again for all of your guidance!
Aug 15 '07 #5
JPG4
5 New Member
Hi Scott,

I have decided to try to take a new approach (unless you can help me with the above issue). I have posted a new discussion under the title "Linking a Text Box in a Form to the Criteria in a Query using "Like" "

Since you have an idea of what I am looking for, any help or suggestions would be wonderful! :-)

Thanks!
Aug 15 '07 #6
Scott Price
1,384 Recognized Expert Top Contributor
Sorry to not get back to you earlier than this, I had to leave the computer for a few hours this afternoon...

What you are trying to do is quite simple actually.

in the criteria section of your query design view, you simply type in the name of the control your are referring to: i.e. Forms![YourFormName].[YourTextBoxName]. Using the Like operator will result in something like this: Like("*" & Forms![YourFormName].[YourTextBoxName] & "*")

That is actually the approach that i was going to steer you towards, using your check boxes to populate a text box with the value you wish to display on the form.

Typing the value in manually is another option that I'm guessing is what you are going to try now. It's equally as valid...

If you instead wish to use your check boxes to populate the text box, we can take a look at the simple vb code that will be needed to do it.

Good luck on your app, and go ahead and post in this thread again if you have more questions regarding the check box portion. I haven't seen your other post, but likely someone else has already started on an answer there...

Regards,
Scott
Aug 16 '07 #7

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

Similar topics

2
by: Ben | last post by:
My current project requires me to create part of a form that is created on the fly. The project consists a list of entries to an event. The name and address and such is easy. The design is detup so...
1
by: James | last post by:
I am creating a system whereby equipment is inspected. Data is inputted into an inspection form. However, any equipment that is not satisfactory needs to have spare parts ordered for that piece of...
4
by: Jared | last post by:
Radio Button or Check Box and Event Procedures I need to insert either radio buttons or check boxes onto my form. I'm not sure which to use, or if there are other options. I am using the buttons...
11
by: Darryl Kerkeslager | last post by:
I wanted to test for only one True value in a bunch of checkboxes, so I figured I could just test for a value of exactly -1 after adding the values. In case 0 below, it worked. But in all other...
5
by: Shreekant Patel | last post by:
Hello, I am new to the advanced level of access, and I have quite a few changes to make to an existing database. The current database's main form needs to have additional check boxes added to...
2
by: V_S_H_Satish | last post by:
Dear Friends I am working as oracle and ms sql dba from last 4 years. My company recently migrated to DB2 databases. So i am very much new to db2 database Can any one pls provide script to...
3
by: acecraig100 | last post by:
I am fairly new to Javascript. I have a form that users fill out to enter an animal to exhibit at a fair. Because we have no way of knowing, how many animals a user may enter, I created a table...
1
by: jerger | last post by:
I have not made a program or page from start yet. I have made modifications to our signoff asp pages like changing the questions, texts, shortening field lengths etc... I also have copied the files...
1
by: stewdizzle | last post by:
I have a from with three radio buttons (same group) and three text boxes. The radio buttons give the user a choice of uploading one, two, or three images. Currently, I have the text boxes load as...
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
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
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...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.