473,387 Members | 1,504 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,387 software developers and data experts.

Returning True/False records from a table using VB

Good afternoon,

Can someone please guide me towards how to return records from a table. I currently have a table with about 21 fields, and 21 records. I have one field that is just text and the remaining fields are checkboxes, which allows the user to select true/false for each record in the text field.

I.E.
Expand|Select|Wrap|Line Numbers
  1. Field Txt       Chkbx1 chkbx2 chkbox3
  2. Eat Apples    True     False        True
Now, how to I loop through this table, for each "FieldTxt" returning only the true values, and then moving on to the next.

This will eventually allow me to have a table that allows the user to select specific charts (via. the checkboxes) they would like to print out, for each record entered in the table.

I would greatly appreciate any help can be offered.
Feb 7 '07 #1
11 2620
Rabbit
12,516 Expert Mod 8TB
Do you mean returning the records where chkbox1 is true regardless of the others, chkbox2 is true, or Chkbox3 is true depending on which check box field the user wanted to see?
Feb 7 '07 #2
nico5038
3,080 Expert 2GB
Your table design isn't normalized, giving this trouble.
You would need for every row 21 rows for the same text.
I guess it's a kind of multiple choice and you would need three fields:
1) Text
2) Option
3) YesNo
Now you'll probably have Option1 being True or False
Now you'll probably have Option2 being True or False, etc.

Such a table can be filtered instantly by checking the YesNo field for being True.

Now you would need to normalize the table like:

select Text, "01" as Origin, Check01 from tblX where Check01=True
UNION
select Text, "02" as Origin, Check01 from tblX where Check02=True
...etc,till
select Text, "21" as Origin, Check21 from tblX where Check21=True;

That UNION can then be used in a new query for filtering the True Check01 from the UNION query.

Nic;o)
Feb 7 '07 #3
Thank you for your response,

I am not clear on what you mean by my table design not being normailzed?
Should I have this checkbox table in a form instead, and then have the information passed to a table??




Your table design isn't normalized, giving this trouble.
You would need for every row 21 rows for the same text.
I guess it's a kind of multiple choice and you would need three fields:
1) Text
2) Option
3) YesNo
Now you'll probably have Option1 being True or False
Now you'll probably have Option2 being True or False, etc.

Such a table can be filtered instantly by checking the YesNo field for being True.

Now you would need to normalize the table like:

select Text, "01" as Origin, Check01 from tblX where Check01=True
UNION
select Text, "02" as Origin, Check01 from tblX where Check02=True
...etc,till
select Text, "21" as Origin, Check21 from tblX where Check21=True;

That UNION can then be used in a new query for filtering the True Check01 from the UNION query.

Nic;o)
Feb 8 '07 #4
Rabbit
12,516 Expert Mod 8TB
This tutorial will teach you about Normalization: Normalisation and Table structures

I should probably read it myself so I know what everyone's talking about when they say normalization.
Feb 8 '07 #5
NeoPa
32,556 Expert Mod 16PB
Thank you for your response,

I am not clear on what you mean by my table design not being normailzed?
Should I have this checkbox table in a form instead, and then have the information passed to a table??
If I understand correctly, Nico is saying your data should be stored as :
Expand|Select|Wrap|Line Numbers
  1. Text           Option    YesNo
  2. Eat Apples     ChkBx1    True
  3. Eat Apples     ChkBx2    False
  4. Eat Apples     ChkBx3    True
This may seem strange to someone not used to it, but it is a design that provides very high levels of flexibility of use of your data when used with SQL.

Maybe we can help more with a clearer understanding of your problem. I found I understood some of the problem but it wasn't clear to me what you're actually after.

PS. Rabbit, YES, go off and read it immediately. I'll be testing you later ;) I expect you know most of it already mind. I found it helped crystalise my understanding. I'd certainly recommend it.
Feb 9 '07 #6
If I understand correctly, Nico is saying your data should be stored as :
Expand|Select|Wrap|Line Numbers
  1. Text           Option    YesNo
  2. Eat Apples     ChkBx1    True
  3. Eat Apples     ChkBx2    False
  4. Eat Apples     ChkBx3    True
This may seem strange to someone not used to it, but it is a design that provides very high levels of flexibility of use of your data when used with SQL.

Maybe we can help more with a clearer understanding of your problem. I found I understood some of the problem but it wasn't clear to me what you're actually after.
ok the problem with having it this procedure, using the previous example. is that there are going to be 21 check boxes for Eat Apples. Now I have 20 other items, (ie. Eat Oranges, Eat Pears, etc) that are going to require another 21 checkboxes.
The person who will end up using this tool will have to scroll through tons of data just to check off a few boxes. Is there anyway to make this process less tedious using normalization?
Feb 9 '07 #7
Rabbit
12,516 Expert Mod 8TB
Ultimately, in the end, I am unsure what you are asking for.
I read your post but I see too much ambiguity about the results you want.
Feb 9 '07 #8
NeoPa
32,556 Expert Mod 16PB
ok the problem with having it this procedure, using the previous example. is that there are going to be 21 check boxes for Eat Apples. Now I have 20 other items, (ie. Eat Oranges, Eat Pears, etc) that are going to require another 21 checkboxes.
The person who will end up using this tool will have to scroll through tons of data just to check off a few boxes. Is there anyway to make this process less tedious using normalization?
In answer to this (specific) question - Yes. Queries can be built to show this data in a number of ways.
Going back to your original question though (which also pertains to this somewhat), as we have a very poor idea of what you have and what you want, it's hard to know what to suggest for you.

One fundamental question for you (don't take this to mean that the whole question is clear just by answering this mind you) - Is there any relation between the 21 options and the 21 records? Or is that merely a coincindence?
Feb 9 '07 #9
In answer to this (specific) question - Yes. Queries can be built to show this data in a number of ways.
Going back to your original question though (which also pertains to this somewhat), as we have a very poor idea of what you have and what you want, it's hard to know what to suggest for you.

One fundamental question for you (don't take this to mean that the whole question is clear just by answering this mind you) - Is there any relation between the 21 options and the 21 records? Or is that merely a coincindence?

Right now there is no relationship established.
Feb 10 '07 #10
Rabbit
12,516 Expert Mod 8TB
Can you provide an example of the results you're looking for? I'm uncertain of what it is that you're looking for.
Feb 13 '07 #11
NeoPa
32,556 Expert Mod 16PB
Right now there is no relationship established.
The question is about a relation, not a relationship.
A Relationship would be a fundamental part of Access (linking tables) but a relation could be something a lot simpler. IE Records related that all have names starting with the same letter.
Please feel free to answer this question (as well as a number of others in your thread) or not. We have no axe to grind, we will simply be unable to help you much without it.
Feb 13 '07 #12

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

Similar topics

2
by: Simon Pleasants | last post by:
Am something of a newbie at this, so please bear with any stupid questions. I have created a database to track shipments that we import. The information is stored in a table and I have created...
7
by: Bill Reed via AccessMonster.com | last post by:
I have a field called "Wiring" in a query which is boolean. If I place "True Or False" in the criteria for the field, I get all records (there are no nulls in the recordset). Likewise if I place...
7
by: Aaron | last post by:
Complete code follows. I am new to .NET programming (and programming in general) and I am having a difficult time understanding how to fill a variable in one sub, and then access it from...
6
by: InnoCreate | last post by:
Hi everyone. I've recently written a classic asp website which uses an MS Access datasource. I know this is less than an ideal data source as it has limited functionality. I have a search form on...
0
by: klove1209 | last post by:
Good afternoon, Can someone please guide me towards how to return records from a table. I currently have a table with about 21 fields, and 21 records. I have one field that is just text and the...
8
by: Martin Z | last post by:
INSERT INTO dbo.Transmission (TransmissionDate, TransmissionDirection, Filename, TransmittedData) VALUES (@TransmissionDate,@TransmissionDirection,@Filename,@TransmittedData); SELECT @retVal =...
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
3
rsmccli
by: rsmccli | last post by:
Access 2002 Hi. I have a command button that will "approve" all records currently being looked at by an "approver". For some reason, even though there are multiple records that exist in the...
2
by: =?Utf-8?B?UGhpbGlw?= | last post by:
I am attempting to insert a simple record with LinqDataSource from a ListView, however I always get a message saying "....LinqDataSource 'dataSource' has no values to insert. Check that the...
0
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,...
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: 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$) { } ...
0
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...
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...
0
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
0
BarryA
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...
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
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...

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.