A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Checkbox



 
 
Thread Tools Display Modes
  #1  
Old May 11th, 2005, 05:31 PM
David
external usenet poster
 
Posts: n/a
Default Checkbox

Hi! I got a problem performing the fuction below in the Access Form i created :
A B C D E
Answer || || || || ||

I'm trying to allow the user to tick the 'checkbox' above with the
possibility that there are more than one answers. How do i capture the data
so that in my database i know that for the Answer there are 2 answers or
more?Any idea how to do that?

Thks!

  #2  
Old May 11th, 2005, 09:13 PM
David Lloyd
external usenet poster
 
Posts: n/a
Default

I would give your checkboxes similar names like names like chkA, chkB, ...
and then loop through the controls collection for the form and read the
value of each checkbox, incrementing a counter for each True value.

For example:

Dim ctl as Control
Dim i as Integer
i=0
For each ctl in Me.Controls
If Left(ctl.Name, 3) = "chk" Then
If ctl.Value = True Then
i = i + 1
End If
End If
Next ctl


--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


"David" wrote in message
...
Hi! I got a problem performing the fuction below in the Access Form i
created :
A B C D E
Answer || || || || ||

I'm trying to allow the user to tick the 'checkbox' above with the
possibility that there are more than one answers. How do i capture the data
so that in my database i know that for the Answer there are 2 answers or
more?Any idea how to do that?

Thks!


  #3  
Old May 11th, 2005, 10:45 PM
Larry Daugherty
external usenet poster
 
Posts: n/a
Default

Most likely the problem is in your table design first and your form
second:

You should have at least

tblQuestion - your questions

tblAnswer - your answers.

Those tables should be related one-to-many

Your form should be based on tblQuestion with a subform based on
tblAnswer. As your form and subform display you can enter a record
with its name (A, B, C, etc.). Each subform will have a check box.

HTH
--
-Larry-
--

"David" wrote in message
...
Hi! I got a problem performing the fuction below in the Access Form

i created :
A B C D E
Answer || || || || ||

I'm trying to allow the user to tick the 'checkbox' above with the
possibility that there are more than one answers. How do i capture

the data
so that in my database i know that for the Answer there are 2

answers or
more?Any idea how to do that?

Thks!



  #4  
Old May 12th, 2005, 01:46 AM
David
external usenet poster
 
Posts: n/a
Default

Hi! where should i apply this code to? From the code you've given me how is
it inserting the data into the database? any extra steps beside that code? do
i need to have link table(form, subform)? I'm very new to this, pls help.
Thks!

"David Lloyd" wrote:

I would give your checkboxes similar names like names like chkA, chkB, ...
and then loop through the controls collection for the form and read the
value of each checkbox, incrementing a counter for each True value.

For example:

Dim ctl as Control
Dim i as Integer
i=0
For each ctl in Me.Controls
If Left(ctl.Name, 3) = "chk" Then
If ctl.Value = True Then
i = i + 1
End If
End If
Next ctl


--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


"David" wrote in message
...
Hi! I got a problem performing the fuction below in the Access Form i
created :
A B C D E
Answer || || || || ||

I'm trying to allow the user to tick the 'checkbox' above with the
possibility that there are more than one answers. How do i capture the data
so that in my database i know that for the Answer there are 2 answers or
more?Any idea how to do that?

Thks!



  #5  
Old May 12th, 2005, 03:38 AM
David
external usenet poster
 
Posts: n/a
Default


Hi! where should i apply this code to? From the code you've given me how is
it inserting the data into the database? any extra steps beside that code? do
i need to have link table(form, subform)? I'm very new to this, pls help.
Thks!

"Larry Daugherty" wrote:

Most likely the problem is in your table design first and your form
second:

You should have at least

tblQuestion - your questions

tblAnswer - your answers.

Those tables should be related one-to-many

Your form should be based on tblQuestion with a subform based on
tblAnswer. As your form and subform display you can enter a record
with its name (A, B, C, etc.). Each subform will have a check box.

HTH
--
-Larry-
--

"David" wrote in message
...
Hi! I got a problem performing the fuction below in the Access Form

i created :
A B C D E
Answer || || || || ||

I'm trying to allow the user to tick the 'checkbox' above with the
possibility that there are more than one answers. How do i capture

the data
so that in my database i know that for the Answer there are 2

answers or
more?Any idea how to do that?

Thks!




  #6  
Old May 12th, 2005, 06:07 AM
Larry Daugherty
external usenet poster
 
Posts: n/a
Default

I didn't give you any code, only suggested table names and contents.
I assumed a more advanced level on your part. What I'm suggesting may
seem like quite a stretch.

I assume that you have a different source for questions and that the
answers are then collected from the respondents (actually, the answers
could be put directly into the database by the respondents after you
have established the names (A,B,C, etc.) for each question).

Design two new tables:

tblQuestion should be a list of every question you're going to ask.
Its Primary Key should be an Autonumber field named QuestionID,
another field, Question, for the actual question, text 255. If you
think your questions may run to 256 characters or more, change the
datatype of field from Text to Memo.

tblAnswer will hold all of the answer names and later, all of the
actual answers. Its PrimaryKey should be QuestionID, an autonumber
field. It will also have a Long Integer field named QuestionID. That
field will be a foreign key on tblQuestion that links this Answer to
that Question (don't worry about it, just do it and later learn why it
works that way. When everything else is working properly this field
will be filled in for you. Next will be a field, Answer, text 20.
(you only need one character if they'll always be single character
names. Next will be a field for the answer, Answers, it will be type
Yes/No (Boolean)

Go to Tools|Relationships and show the above two tables. Draw a line
between tblQuestion.QuestionID to tblAnswer.QuestionID. Doubleclick
that line. Click enforce Referential Integrity and Cascade deletes.
the relationship is One - tblQuestion to Many -tblAnswer.

in the Database|tables window, select tblQuestion and then click the
AutoForm Wizard Icon. It Will design you a fairly simple form. Make
the textbox for the Question fairly large.

Drag the bottom of the form downward by more than the size of the
question guest textbox so that you have a large space.

Go back to Database|tables and select tblAnswer. Click the Autoform
Wizard Icon and let it create a very simple form for you. Open the
form in design mode. If the form's header and footer are visible,
turn them off. re-design what's left so that it fits into one line
across. In the form's properties make it's default view "continuous".
Save this form giving it a name something like "sufAnswer"

Open form Question in design view and then hit the restore button so
that you can see the database window behind the form. Find sufAnswer
in the Database|Forms window and drag it into the blank area below the
textbox on formQuestion. Save the form. Twiddle with it to get a
somewhat usable appearance and then start to test it.

Enter your first few questions in the Question textbox on the main
form. Pay no attention to the subform just yet. After you have
entered 5 questions or so then close the form and then re-open it. By
what ever means you determine, decide what answer names belong to each
question. You'll notice that as soon as you start to enter data in
one subform record another record is presented. (that record will go
away if you put no data into it).

When you get that much working you're well on your way to knowing how
to handle these few issues - you'd be surprised how often they come up
if you continue to create Access applications.

If my explanations of the creation and integration of the form/subform
left you dizzy or were just plain wrong, there is some pretty good
stuff in Access help that walks you through the same steps. Look for
Subform/subreport.

There are lots of places to get bits of Access lo this newsgroup
and several others, especially tablesdesign, forms, formscoding and
the ever popular gettingstarted. Check out www.mvps.org/access for
lots of advice and goodies.

HTH
--
-Larry-
--

"David" wrote in message
...

Hi! where should i apply this code to? From the code you've given me

how is
it inserting the data into the database? any extra steps beside that

code? do
i need to have link table(form, subform)? I'm very new to this, pls

help.
Thks!

"Larry Daugherty" wrote:

Most likely the problem is in your table design first and your

form
second:

You should have at least

tblQuestion - your questions

tblAnswer - your answers.

Those tables should be related one-to-many

Your form should be based on tblQuestion with a subform based on
tblAnswer. As your form and subform display you can enter a

record
with its name (A, B, C, etc.). Each subform will have a check

box.

HTH
--
-Larry-
--

"David" wrote in message
...
Hi! I got a problem performing the fuction below in the Access

Form
i created :
A B C D E
Answer || || || || ||

I'm trying to allow the user to tick the 'checkbox' above with

the
possibility that there are more than one answers. How do i

capture
the data
so that in my database i know that for the Answer there are 2

answers or
more?Any idea how to do that?

Thks!






  #7  
Old May 12th, 2005, 08:28 AM
David
external usenet poster
 
Posts: n/a
Default

Hi! Thks!

Will it be any problem if i'm using Access as the front end and SQL200 as
the database ? How it be any issue if i'm using link tables?

Thks!

"Larry Daugherty" wrote:

I didn't give you any code, only suggested table names and contents.
I assumed a more advanced level on your part. What I'm suggesting may
seem like quite a stretch.

I assume that you have a different source for questions and that the
answers are then collected from the respondents (actually, the answers
could be put directly into the database by the respondents after you
have established the names (A,B,C, etc.) for each question).

Design two new tables:

tblQuestion should be a list of every question you're going to ask.
Its Primary Key should be an Autonumber field named QuestionID,
another field, Question, for the actual question, text 255. If you
think your questions may run to 256 characters or more, change the
datatype of field from Text to Memo.

tblAnswer will hold all of the answer names and later, all of the
actual answers. Its PrimaryKey should be QuestionID, an autonumber
field. It will also have a Long Integer field named QuestionID. That
field will be a foreign key on tblQuestion that links this Answer to
that Question (don't worry about it, just do it and later learn why it
works that way. When everything else is working properly this field
will be filled in for you. Next will be a field, Answer, text 20.
(you only need one character if they'll always be single character
names. Next will be a field for the answer, Answers, it will be type
Yes/No (Boolean)

Go to Tools|Relationships and show the above two tables. Draw a line
between tblQuestion.QuestionID to tblAnswer.QuestionID. Doubleclick
that line. Click enforce Referential Integrity and Cascade deletes.
the relationship is One - tblQuestion to Many -tblAnswer.

in the Database|tables window, select tblQuestion and then click the
AutoForm Wizard Icon. It Will design you a fairly simple form. Make
the textbox for the Question fairly large.

Drag the bottom of the form downward by more than the size of the
question guest textbox so that you have a large space.

Go back to Database|tables and select tblAnswer. Click the Autoform
Wizard Icon and let it create a very simple form for you. Open the
form in design mode. If the form's header and footer are visible,
turn them off. re-design what's left so that it fits into one line
across. In the form's properties make it's default view "continuous".
Save this form giving it a name something like "sufAnswer"

Open form Question in design view and then hit the restore button so
that you can see the database window behind the form. Find sufAnswer
in the Database|Forms window and drag it into the blank area below the
textbox on formQuestion. Save the form. Twiddle with it to get a
somewhat usable appearance and then start to test it.

Enter your first few questions in the Question textbox on the main
form. Pay no attention to the subform just yet. After you have
entered 5 questions or so then close the form and then re-open it. By
what ever means you determine, decide what answer names belong to each
question. You'll notice that as soon as you start to enter data in
one subform record another record is presented. (that record will go
away if you put no data into it).

When you get that much working you're well on your way to knowing how
to handle these few issues - you'd be surprised how often they come up
if you continue to create Access applications.

If my explanations of the creation and integration of the form/subform
left you dizzy or were just plain wrong, there is some pretty good
stuff in Access help that walks you through the same steps. Look for
Subform/subreport.

There are lots of places to get bits of Access lo this newsgroup
and several others, especially tablesdesign, forms, formscoding and
the ever popular gettingstarted. Check out www.mvps.org/access for
lots of advice and goodies.

HTH
--
-Larry-
--

"David" wrote in message
...

Hi! where should i apply this code to? From the code you've given me

how is
it inserting the data into the database? any extra steps beside that

code? do
i need to have link table(form, subform)? I'm very new to this, pls

help.
Thks!

"Larry Daugherty" wrote:

Most likely the problem is in your table design first and your

form
second:

You should have at least

tblQuestion - your questions

tblAnswer - your answers.

Those tables should be related one-to-many

Your form should be based on tblQuestion with a subform based on
tblAnswer. As your form and subform display you can enter a

record
with its name (A, B, C, etc.). Each subform will have a check

box.

HTH
--
-Larry-
--

"David" wrote in message
...
Hi! I got a problem performing the fuction below in the Access

Form
i created :
A B C D E
Answer || || || || ||

I'm trying to allow the user to tick the 'checkbox' above with

the
possibility that there are more than one answers. How do i

capture
the data
so that in my database i know that for the Answer there are 2
answers or
more?Any idea how to do that?

Thks!







  #8  
Old May 12th, 2005, 08:53 AM
Larry Daugherty
external usenet poster
 
Posts: n/a
Default

I had Access/Jet in mind. I don't know how you implement referential
integrity in SQL server.

I suggest you get it working in Access first and get a good grip on
what you're doing before you move the back end to SQL Server.

HTH
--
-Larry-
--

"David" wrote in message
...
Hi! Thks!

Will it be any problem if i'm using Access as the front end and

SQL200 as
the database ? How it be any issue if i'm using link tables?

Thks!

"Larry Daugherty" wrote:

I didn't give you any code, only suggested table names and

contents.
I assumed a more advanced level on your part. What I'm suggesting

may
seem like quite a stretch.

I assume that you have a different source for questions and that

the
answers are then collected from the respondents (actually, the

answers
could be put directly into the database by the respondents after

you
have established the names (A,B,C, etc.) for each question).

Design two new tables:

tblQuestion should be a list of every question you're going to

ask.
Its Primary Key should be an Autonumber field named QuestionID,
another field, Question, for the actual question, text 255. If

you
think your questions may run to 256 characters or more, change the
datatype of field from Text to Memo.

tblAnswer will hold all of the answer names and later, all of the
actual answers. Its PrimaryKey should be QuestionID, an

autonumber
field. It will also have a Long Integer field named QuestionID.

That
field will be a foreign key on tblQuestion that links this Answer

to
that Question (don't worry about it, just do it and later learn

why it
works that way. When everything else is working properly this

field
will be filled in for you. Next will be a field, Answer, text 20.
(you only need one character if they'll always be single character
names. Next will be a field for the answer, Answers, it will be

type
Yes/No (Boolean)

Go to Tools|Relationships and show the above two tables. Draw a

line
between tblQuestion.QuestionID to tblAnswer.QuestionID.

Doubleclick
that line. Click enforce Referential Integrity and Cascade

deletes.
the relationship is One - tblQuestion to Many -tblAnswer.

in the Database|tables window, select tblQuestion and then click

the
AutoForm Wizard Icon. It Will design you a fairly simple form.

Make
the textbox for the Question fairly large.

Drag the bottom of the form downward by more than the size of the
question guest textbox so that you have a large space.

Go back to Database|tables and select tblAnswer. Click the

Autoform
Wizard Icon and let it create a very simple form for you. Open

the
form in design mode. If the form's header and footer are visible,
turn them off. re-design what's left so that it fits into one line
across. In the form's properties make it's default view

"continuous".
Save this form giving it a name something like "sufAnswer"

Open form Question in design view and then hit the restore button

so
that you can see the database window behind the form. Find

sufAnswer
in the Database|Forms window and drag it into the blank area below

the
textbox on formQuestion. Save the form. Twiddle with it to get a
somewhat usable appearance and then start to test it.

Enter your first few questions in the Question textbox on the main
form. Pay no attention to the subform just yet. After you have
entered 5 questions or so then close the form and then re-open it.

By
what ever means you determine, decide what answer names belong to

each
question. You'll notice that as soon as you start to enter data

in
one subform record another record is presented. (that record will

go
away if you put no data into it).

When you get that much working you're well on your way to knowing

how
to handle these few issues - you'd be surprised how often they

come up
if you continue to create Access applications.

If my explanations of the creation and integration of the

form/subform
left you dizzy or were just plain wrong, there is some pretty good
stuff in Access help that walks you through the same steps. Look

for
Subform/subreport.

There are lots of places to get bits of Access lo this

newsgroup
and several others, especially tablesdesign, forms, formscoding

and
the ever popular gettingstarted. Check out www.mvps.org/access

for
lots of advice and goodies.

HTH
--
-Larry-
--

"David" wrote in message
...

Hi! where should i apply this code to? From the code you've

given me
how is
it inserting the data into the database? any extra steps beside

that
code? do
i need to have link table(form, subform)? I'm very new to this,

pls
help.
Thks!

"Larry Daugherty" wrote:

Most likely the problem is in your table design first and your

form
second:

You should have at least

tblQuestion - your questions

tblAnswer - your answers.

Those tables should be related one-to-many

Your form should be based on tblQuestion with a subform based

on
tblAnswer. As your form and subform display you can enter a

record
with its name (A, B, C, etc.). Each subform will have a check

box.

HTH
--
-Larry-
--

"David" wrote in message
...
Hi! I got a problem performing the fuction below in the

Access
Form
i created :
A B C D E
Answer || || || || ||

I'm trying to allow the user to tick the 'checkbox' above

with
the
possibility that there are more than one answers. How do i

capture
the data
so that in my database i know that for the Answer there are

2
answers or
more?Any idea how to do that?

Thks!









 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkbox command hsdaguilar Using Forms 2 May 11th, 2005 04:20 PM
Checkbox Click w/o AfterUpdate Firing????? JP Using Forms 2 April 11th, 2005 03:48 PM
Checkbox Chip1035 Using Forms 9 April 6th, 2005 10:19 PM
Field View when checkmark in checkbox Chip1035 New Users 3 March 17th, 2005 05:49 PM
How to hide checkbox when the datasource contain bool value Abhi poddar Setting Up & Running Reports 3 December 23rd, 2004 12:52 PM


All times are GMT +1. The time now is 01:07 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.