Query Problems

J

James

Hello there I have the following SQL....

-----------------------------------------------------------

SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select Count
(*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) And
(([Question])=[Forms]![frmqry]![cboQuestion]) And
(([tblResponses].[Answer])=[Forms]![frmqry]![cboAnswer]));

-----------------------------------------------------------

Where by when I run the query from the form with values in
the cboboxes it asks me to put in the Gender and the
Question again does anyone know why this is?

Also I have tried the following code:

-----------------------------------------------------------

SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select Count
(*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([tblResponses].Gender)=[Forms]![frmqry]!
[cboGender]) And (([tblResponses].Question)=[Forms]!
[frmqry]![cboQuestion]) And (([tblResponses].[Answer])=
[Forms]![frmqry]![cboAnswer]));

-----------------------------------------------------------


And I still get the same problem. How can I get it to
recognise the values? When I type in the values which are
correct to the table I get no results returened even
thought there is data in the table.

Many Thanks or any assistence given

James
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You might try adding the PARAMETERS clause:

PARAMETERS [Forms]![frmqry]![cboGender] Text,
[Forms]![frmqry]![cboQuestion] Text,
[Forms]![frmqry]![cboAnswer] Text;
SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select Count
(*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE Gender = [Forms]![frmqry]![cboGender]
And Question = [Forms]![frmqry]![cboQuestion]
And Answer = [Forms]![frmqry]![cboAnswer]

The above assumes the data types of each parameter is TEXT. Change them
to the appropriate data type if necessary.

Of course, you know that the form "frmQry" has to be open and the
controls have to have valid values (not null).

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQI641IechKqOuFEgEQJC0gCfUPnHmo/rfz5JTqve9j41IHngHf0AoJV0
lKCJD+paDuVnSFNlqKPMmLFK
=4qv7
-----END PGP SIGNATURE-----
 
J

James

I or the user sees text but when I look at the tables they
are a number value....

How do I get it to look at a number value? but still have
the cbobox producing the text rather than a number?

Many Thanks

James
-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You might try adding the PARAMETERS clause:

PARAMETERS [Forms]![frmqry]![cboGender] Text,
[Forms]![frmqry]![cboQuestion] Text,
[Forms]![frmqry]![cboAnswer] Text;
SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select Count
(*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE Gender = [Forms]![frmqry]![cboGender]
And Question = [Forms]![frmqry]![cboQuestion]
And Answer = [Forms]![frmqry]![cboAnswer]

The above assumes the data types of each parameter is TEXT. Change them
to the appropriate data type if necessary.

Of course, you know that the form "frmQry" has to be open and the
controls have to have valid values (not null).

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQI641IechKqOuFEgEQJC0gCfUPnHmo/rfz5JTqve9j41IHngHf 0AoJV0
lKCJD+paDuVnSFNlqKPMmLFK
=4qv7
-----END PGP SIGNATURE-----

Hello there I have the following SQL....

-------------------------------------------------------- ---

SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select Count
(*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) And
(([Question])=[Forms]![frmqry]![cboQuestion]) And
(([tblResponses].[Answer])=[Forms]![frmqry]! [cboAnswer]));

-------------------------------------------------------- ---

Where by when I run the query from the form with values in
the cboboxes it asks me to put in the Gender and the
Question again does anyone know why this is?

Also I have tried the following code:

-------------------------------------------------------- ---

SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select Count
(*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([tblResponses].Gender)=[Forms]![frmqry]!
[cboGender]) And (([tblResponses].Question)=[Forms]!
[frmqry]![cboQuestion]) And (([tblResponses].[Answer])=
[Forms]![frmqry]![cboAnswer]));

-------------------------------------------------------- ---


And I still get the same problem. How can I get it to
recognise the values? When I type in the values which are
correct to the table I get no results returened even
thought there is data in the table.

Many Thanks or any assistence given

James

.
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If the table shows a numeric value in the column that is what is
important. Open the table in design view and read the data type for
each of the pertinent columns (put the cursor on the Data Type column of
the column (Field Name) and in the Field Properties section, below, read
the Field Size value (one of Integer, Long Integer, Double, Single,
Byte, Replication ID [for replication only] and Decimal [in A2K & >
only]). Whatever appears in the Field Size property put as the data
type of the associated query parameter (use Long for Long Integer).
Read the Access Help articles on data types for more info.

The ComboBox RowSource should have a query or an SQL statement that has
both the ID column (usually the number) and the description (the text
part). The ComboBox's BoundColumn property should be for the ID, or
numeric, column. This usually means that the text value shows in the
ComboBox and the numeric value is stored in the table. Read the Access
Help article on Combo Boxes for more info.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQJBCl4echKqOuFEgEQKUhgCg2fsa/8g7jMriCOvNjeBGkKJRw2cAoLjJ
E/mWwHFaW/ggJ/ATSJ741yn4
=55yF
-----END PGP SIGNATURE-----

I or the user sees text but when I look at the tables they
are a number value....

How do I get it to look at a number value? but still have
the cbobox producing the text rather than a number?

Many Thanks

James

-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You might try adding the PARAMETERS clause:

PARAMETERS [Forms]![frmqry]![cboGender] Text,
[Forms]![frmqry]![cboQuestion] Text,
[Forms]![frmqry]![cboAnswer] Text;
SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select Count
(*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE Gender = [Forms]![frmqry]![cboGender]
And Question = [Forms]![frmqry]![cboQuestion]
And Answer = [Forms]![frmqry]![cboAnswer]

The above assumes the data types of each parameter is

TEXT. Change them
to the appropriate data type if necessary.

Of course, you know that the form "frmQry" has to be open

and the
controls have to have valid values (not null).

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQI641IechKqOuFEgEQJC0gCfUPnHmo/rfz5JTqve9j41IHngHf
0AoJV0

lKCJD+paDuVnSFNlqKPMmLFK
=4qv7
-----END PGP SIGNATURE-----


James wrote:

Hello there I have the following SQL....

--------------------------------------------------------
---
SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select
Count
(*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) And
(([Question])=[Forms]![frmqry]![cboQuestion]) And
(([tblResponses].[Answer])=[Forms]![frmqry]!
[cboAnswer]));

---
Where by when I run the query from the form with values
in
the cboboxes it asks me to put in the Gender and the
Question again does anyone know why this is?

Also I have tried the following code:

--------------------------------------------------------
---
SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select
Count
(*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([tblResponses].Gender)=[Forms]![frmqry]!
[cboGender]) And (([tblResponses].Question)=[Forms]!
[frmqry]![cboQuestion]) And (([tblResponses].[Answer])=
[Forms]![frmqry]![cboAnswer]));

--------------------------------------------------------
---
And I still get the same problem. How can I get it to
recognise the values? When I type in the values which
are
correct to the table I get no results returened even
thought there is data in the table.

Many Thanks or any assistence given

James

.
 
J

James

Hi I have done the following:

-----------------------------------------------------------

PARAMETERS [Forms]![frmqry]![cboGender] Number ( Long
Integer ), [Forms]![frmqry]![cboQuestion] Number ( Long
Integer ), [Forms]![frmqry]![cboAnswer] Yes/No
(True/False );
SELECT TOP 1 Count(1) AS ReturnCount, 100*Count(1)/(Select
Count (*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) AND
(([Question])=[Forms]![frmqry]![cboQuestion]) AND
((tblResponses.Answer)=[Forms]![frmqry]![cboAnswer]))
ORDER BY 100*Count(1)/(Select Count (*) FROM tblResponses);

-----------------------------------------------------------

Is this correct or do I need to change anything?? as its
telling me the syntex is wrong the the Parameters bit...

Many Thanks

James
-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If the table shows a numeric value in the column that is what is
important. Open the table in design view and read the data type for
each of the pertinent columns (put the cursor on the Data Type column of
the column (Field Name) and in the Field Properties section, below, read
the Field Size value (one of Integer, Long Integer, Double, Single,
Byte, Replication ID [for replication only] and Decimal [in A2K & >
only]). Whatever appears in the Field Size property put as the data
type of the associated query parameter (use Long for Long Integer).
Read the Access Help articles on data types for more info.

The ComboBox RowSource should have a query or an SQL statement that has
both the ID column (usually the number) and the description (the text
part). The ComboBox's BoundColumn property should be for the ID, or
numeric, column. This usually means that the text value shows in the
ComboBox and the numeric value is stored in the table. Read the Access
Help article on Combo Boxes for more info.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQJBCl4echKqOuFEgEQKUhgCg2fsa/8g7jMriCOvNjeBGkKJRw2 cAoLjJ
E/mWwHFaW/ggJ/ATSJ741yn4
=55yF
-----END PGP SIGNATURE-----

I or the user sees text but when I look at the tables they
are a number value....

How do I get it to look at a number value? but still have
the cbobox producing the text rather than a number?

Many Thanks

James

-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You might try adding the PARAMETERS clause:

PARAMETERS [Forms]![frmqry]![cboGender] Text,
[Forms]![frmqry]![cboQuestion] Text,
[Forms]![frmqry]![cboAnswer] Text;
SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select Count
(*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE Gender = [Forms]![frmqry]![cboGender]
And Question = [Forms]![frmqry]![cboQuestion]
And Answer = [Forms]![frmqry]![cboAnswer]

The above assumes the data types of each parameter is

TEXT. Change them
to the appropriate data type if necessary.

Of course, you know that the form "frmQry" has to be
open

and the
controls have to have valid values (not null).

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQI641IechKqOuFEgEQJC0gCfUPnHmo/rfz5JTqve9j41IHng
Hf

0AoJV0
lKCJD+paDuVnSFNlqKPMmLFK
=4qv7
-----END PGP SIGNATURE-----


James wrote:


Hello there I have the following SQL....

-------------------------------------------------------
-

---
SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select
Count

(*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) And
(([Question])=[Forms]![frmqry]![cboQuestion]) And
(([tblResponses].[Answer])=[Forms]![frmqry]!
[cboAnswer]));

-------------------------------------------------------
-

---
Where by when I run the query from the form with
values

in
the cboboxes it asks me to put in the Gender and the
Question again does anyone know why this is?

Also I have tried the following code:

-------------------------------------------------------
-

---
SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select
Count

(*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([tblResponses].Gender)=[Forms]![frmqry]!
[cboGender]) And (([tblResponses].Question)=[Forms]!
[frmqry]![cboQuestion]) And (([tblResponses].[Answer])=
[Forms]![frmqry]![cboAnswer]));

-------------------------------------------------------
-

---
And I still get the same problem. How can I get it to
recognise the values? When I type in the values which
are

correct to the table I get no results returened even
thought there is data in the table.

Many Thanks or any assistence given

James


.

.
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The correct PARAMETERS syntax is:

PARAMETERS [Forms]![frmqry]![cboGender] Long ,
[Forms]![frmqry]![cboQuestion] Long ,
[Forms]![frmqry]![cboAnswer] Bit;

An less complex ORDER BY syntax can be:

ORDER BY 2

2 is the 2nd column in the SELECT clause. This can be used instead of
the complex expression used to create the column 2 value.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQJFikIechKqOuFEgEQJIDACg8KZ/1cRZjwphd1Qk43vcqHMEXDcAn36B
xOUHc4dB5D2WpFCuSb04Ga+p
=a8K4
-----END PGP SIGNATURE-----

Hi I have done the following:

-----------------------------------------------------------

PARAMETERS [Forms]![frmqry]![cboGender] Number ( Long
Integer ), [Forms]![frmqry]![cboQuestion] Number ( Long
Integer ), [Forms]![frmqry]![cboAnswer] Yes/No
(True/False );
SELECT TOP 1 Count(1) AS ReturnCount, 100*Count(1)/(Select
Count (*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) AND
(([Question])=[Forms]![frmqry]![cboQuestion]) AND
((tblResponses.Answer)=[Forms]![frmqry]![cboAnswer]))
ORDER BY 100*Count(1)/(Select Count (*) FROM tblResponses);

-----------------------------------------------------------

Is this correct or do I need to change anything?? as its
telling me the syntex is wrong the the Parameters bit...

Many Thanks

James

-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If the table shows a numeric value in the column that is

what is
important. Open the table in design view and read the

data type for
each of the pertinent columns (put the cursor on the Data

Type column of
the column (Field Name) and in the Field Properties

section, below, read
the Field Size value (one of Integer, Long Integer,

Double, Single,
Byte, Replication ID [for replication only] and Decimal

[in A2K & >
only]). Whatever appears in the Field Size property put

as the data
type of the associated query parameter (use Long for Long
Integer).

Read the Access Help articles on data types for more info.

The ComboBox RowSource should have a query or an SQL

statement that has
both the ID column (usually the number) and the

description (the text
part). The ComboBox's BoundColumn property should be for

the ID, or
numeric, column. This usually means that the text value

shows in the
ComboBox and the numeric value is stored in the table.

Read the Access
Help article on Combo Boxes for more info.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQJBCl4echKqOuFEgEQKUhgCg2fsa/8g7jMriCOvNjeBGkKJRw2
cAoLjJ

E/mWwHFaW/ggJ/ATSJ741yn4
=55yF
-----END PGP SIGNATURE-----


James wrote:

I or the user sees text but when I look at the tables
they
are a number value....

How do I get it to look at a number value? but still
have
the cbobox producing the text rather than a number?

Many Thanks

James



-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You might try adding the PARAMETERS clause:

PARAMETERS [Forms]![frmqry]![cboGender] Text,
[Forms]![frmqry]![cboQuestion] Text,
[Forms]![frmqry]![cboAnswer] Text;
SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select
Count
(*) FROM tblResponses) AS ReturnPercentage

FROM tblResponses


WHERE Gender = [Forms]![frmqry]![cboGender]
And Question = [Forms]![frmqry]![cboQuestion]
And Answer = [Forms]![frmqry]![cboAnswer]

The above assumes the data types of each parameter is

TEXT. Change them


to the appropriate data type if necessary.

Of course, you know that the form "frmQry" has to be
open
and the


controls have to have valid values (not null).

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQI641IechKqOuFEgEQJC0gCfUPnHmo/rfz5JTqve9j41IHng
Hf
0AoJV0


lKCJD+paDuVnSFNlqKPMmLFK
=4qv7
-----END PGP SIGNATURE-----


James wrote:



Hello there I have the following SQL....

-------------------------------------------------------
-
---


SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select

Count


(*) FROM tblResponses) AS ReturnPercentage

FROM tblResponses

WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) And
(([Question])=[Forms]![frmqry]![cboQuestion]) And
(([tblResponses].[Answer])=[Forms]![frmqry]!

[cboAnswer]));


-------------------------------------------------------
-
values
in


the cboboxes it asks me to put in the Gender and the
Question again does anyone know why this is?

Also I have tried the following code:

-------------------------------------------------------
-
---


SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select

Count


(*) FROM tblResponses) AS ReturnPercentage

FROM tblResponses

WHERE ((([tblResponses].Gender)=[Forms]![frmqry]!
[cboGender]) And (([tblResponses].Question)=[Forms]!
[frmqry]![cboQuestion]) And (([tblResponses].[Answer])=
[Forms]![frmqry]![cboAnswer]));

-------------------------------------------------------
-
---


And I still get the same problem. How can I get it to
recognise the values? When I type in the values which

are


correct to the table I get no results returened even
thought there is data in the table.

Many Thanks or any assistence given

James


.

.
 
J

James

Ok I now have the following:

-----------------------------------------------------------

PARAMETERS [Forms]![frmqry]![cboGender] Long, [Forms]!
[frmqry]![cboQuestion] Long, [Forms]![frmqry]![cboAnswer]
Bit;
SELECT TOP 1 Count(1) AS ReturnCount, 100*Count(1)/(Select
Count (*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) And
(([Question])=[Forms]![frmqry]![cboQuestion]) And
(([tblResponses].[Answer])=[Forms]![frmqry]![cboAnswer]))
ORDER BY 2;

-----------------------------------------------------------

This work fine... (I think)

When in the form I select values in the actual cboboxes
and click calculate which just simply runs a query for
me...

but for some reason it pops up a box which tells me that I
need to input the Gender and the Question number...

Even when I do this everything is returned as 0

No matter what I put in there... and there is data in teh
actual table of tblResponses....

Also how do I get the percentage to appear in a text box
on my form?

Many Thanks

James

-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The correct PARAMETERS syntax is:

PARAMETERS [Forms]![frmqry]![cboGender] Long ,
[Forms]![frmqry]![cboQuestion] Long ,
[Forms]![frmqry]![cboAnswer] Bit;

An less complex ORDER BY syntax can be:

ORDER BY 2

2 is the 2nd column in the SELECT clause. This can be used instead of
the complex expression used to create the column 2 value.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQJFikIechKqOuFEgEQJIDACg8KZ/1cRZjwphd1Qk43vcqHMEXD cAn36B
xOUHc4dB5D2WpFCuSb04Ga+p
=a8K4
-----END PGP SIGNATURE-----

Hi I have done the following:

-------------------------------------------------------- ---

PARAMETERS [Forms]![frmqry]![cboGender] Number ( Long
Integer ), [Forms]![frmqry]![cboQuestion] Number ( Long
Integer ), [Forms]![frmqry]![cboAnswer] Yes/No
(True/False );
SELECT TOP 1 Count(1) AS ReturnCount, 100*Count(1)/ (Select
Count (*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) AND
(([Question])=[Forms]![frmqry]![cboQuestion]) AND
((tblResponses.Answer)=[Forms]![frmqry]![cboAnswer]))
ORDER BY 100*Count(1)/(Select Count (*) FROM tblResponses);

-------------------------------------------------------- ---

Is this correct or do I need to change anything?? as its
telling me the syntex is wrong the the Parameters bit...

Many Thanks

James

-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If the table shows a numeric value in the column that
is

what is
important. Open the table in design view and read the

data type for
each of the pertinent columns (put the cursor on the
Data

Type column of
the column (Field Name) and in the Field Properties

section, below, read
the Field Size value (one of Integer, Long Integer,

Double, Single,
Byte, Replication ID [for replication only] and Decimal

[in A2K & >
only]). Whatever appears in the Field Size property
put

as the data
type of the associated query parameter (use Long for
Long

Integer).
Read the Access Help articles on data types for more info.

The ComboBox RowSource should have a query or an SQL

statement that has
both the ID column (usually the number) and the

description (the text
part). The ComboBox's BoundColumn property should be
for

the ID, or
numeric, column. This usually means that the text
value

shows in the
ComboBox and the numeric value is stored in the table.

Read the Access
Help article on Combo Boxes for more info.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQJBCl4echKqOuFEgEQKUhgCg2fsa/8g7jMriCOvNjeBGkKJR
w2

cAoLjJ
E/mWwHFaW/ggJ/ATSJ741yn4
=55yF
-----END PGP SIGNATURE-----


James wrote:


I or the user sees text but when I look at the tables
they

are a number value....

How do I get it to look at a number value? but still
have

the cbobox producing the text rather than a number?

Many Thanks

James



-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You might try adding the PARAMETERS clause:

PARAMETERS [Forms]![frmqry]![cboGender] Text,
[Forms]![frmqry]![cboQuestion] Text,
[Forms]![frmqry]![cboAnswer] Text;
SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select
Count

(*) FROM tblResponses) AS ReturnPercentage

FROM tblResponses


WHERE Gender = [Forms]![frmqry]![cboGender]
And Question = [Forms]![frmqry]![cboQuestion]
And Answer = [Forms]![frmqry]![cboAnswer]

The above assumes the data types of each parameter is

TEXT. Change them


to the appropriate data type if necessary.

Of course, you know that the form "frmQry" has to be
open

and the


controls have to have valid values (not null).

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQI641IechKqOuFEgEQJC0gCfUPnHmo/rfz5JTqve9j41IH
ng

Hf
0AoJV0


lKCJD+paDuVnSFNlqKPMmLFK
=4qv7
-----END PGP SIGNATURE-----


James wrote:



Hello there I have the following SQL....

-----------------------------------------------------
--

-
---


SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select

Count


(*) FROM tblResponses) AS ReturnPercentage

FROM tblResponses

WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) And
(([Question])=[Forms]![frmqry]![cboQuestion]) And
(([tblResponses].[Answer])=[Forms]![frmqry]!

[cboAnswer]));


-----------------------------------------------------
--

-
---


Where by when I run the query from the form with
values

in


the cboboxes it asks me to put in the Gender and the
Question again does anyone know why this is?

Also I have tried the following code:

-----------------------------------------------------
--

-
---


SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select

Count


(*) FROM tblResponses) AS ReturnPercentage

FROM tblResponses

WHERE ((([tblResponses].Gender)=[Forms]![frmqry]!
[cboGender]) And (([tblResponses].Question)=[Forms]!
[frmqry]![cboQuestion]) And (([tblResponses]. [Answer])=
[Forms]![frmqry]![cboAnswer]));

-----------------------------------------------------
--

-
---


And I still get the same problem. How can I get it to
recognise the values? When I type in the values which

are


correct to the table I get no results returened even
thought there is data in the table.

Many Thanks or any assistence given

James


.


.

.
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is the form frmQuery open? Are there any values in the ComboBoxes when
you run the query? Are the BoundColumns of the ComboBoxes set to the
correct column in the ComboBoxes, the numeric value columns? Remember
BoundColumns are 1-based; this means the 1st column is column 1 not 0.

To show the percentage in a TextBox: the easiest way is to use a
DLookup() function in the TextBox's ControlSource property:

ControlSource: =DLookup("ReturnPercentage","QueryName")

Change the QueryName to whatever name you have given the query.

Now, instead of running the query when a button is pushed instead you
Requery the TextBox. That will cause the DLookup() to re-run the query
& get the percentage. You can do the same thing for the ReturnCount -
new TextBox w/ similar ControlSource, just use "ReturnCount" in place of
"ReturnPercentage." E.g.:

Private Sub cmdRequery_Click()

Me!Percentage.Requery
Me!RecordCount.Requery

End Sub

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQJLhpYechKqOuFEgEQKcpQCdGfj7JFG4Q0m8fvXHIVLLMjD2Q2kAn0ZD
1koFHskA87SuZ3MKm3q+dbL8
=XPSu
-----END PGP SIGNATURE-----

Ok I now have the following:

-----------------------------------------------------------

PARAMETERS [Forms]![frmqry]![cboGender] Long, [Forms]!
[frmqry]![cboQuestion] Long, [Forms]![frmqry]![cboAnswer]
Bit;
SELECT TOP 1 Count(1) AS ReturnCount, 100*Count(1)/(Select
Count (*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) And
(([Question])=[Forms]![frmqry]![cboQuestion]) And
(([tblResponses].[Answer])=[Forms]![frmqry]![cboAnswer]))
ORDER BY 2;

-----------------------------------------------------------

This work fine... (I think)

When in the form I select values in the actual cboboxes
and click calculate which just simply runs a query for
me...

but for some reason it pops up a box which tells me that I
need to input the Gender and the Question number...

Even when I do this everything is returned as 0

No matter what I put in there... and there is data in teh
actual table of tblResponses....

Also how do I get the percentage to appear in a text box
on my form?

Many Thanks

James


-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The correct PARAMETERS syntax is:

PARAMETERS [Forms]![frmqry]![cboGender] Long ,
[Forms]![frmqry]![cboQuestion] Long ,
[Forms]![frmqry]![cboAnswer] Bit;

An less complex ORDER BY syntax can be:

ORDER BY 2

2 is the 2nd column in the SELECT clause. This can be

used instead of
the complex expression used to create the column 2 value.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQJFikIechKqOuFEgEQJIDACg8KZ/1cRZjwphd1Qk43vcqHMEXD
cAn36B

xOUHc4dB5D2WpFCuSb04Ga+p
=a8K4
-----END PGP SIGNATURE-----


James wrote:

Hi I have done the following:

--------------------------------------------------------
---
PARAMETERS [Forms]![frmqry]![cboGender] Number ( Long
Integer ), [Forms]![frmqry]![cboQuestion] Number ( Long
Integer ), [Forms]![frmqry]![cboAnswer] Yes/No
(True/False );
SELECT TOP 1 Count(1) AS ReturnCount, 100*Count(1)/
(Select
Count (*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) AND
(([Question])=[Forms]![frmqry]![cboQuestion]) AND
((tblResponses.Answer)=[Forms]![frmqry]![cboAnswer]))
ORDER BY 100*Count(1)/(Select Count (*) FROM
tblResponses);

---
Is this correct or do I need to change anything?? as
its
telling me the syntex is wrong the the Parameters bit...

Many Thanks

James



-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If the table shows a numeric value in the column that
is
what is


important. Open the table in design view and read the

data type for


each of the pertinent columns (put the cursor on the
Data
Type column of


the column (Field Name) and in the Field Properties

section, below, read


the Field Size value (one of Integer, Long Integer,

Double, Single,


Byte, Replication ID [for replication only] and Decimal

[in A2K & >

only]). Whatever appears in the Field Size property
put
as the data


type of the associated query parameter (use Long for
Long
Integer).


Read the Access Help articles on data types for more
info.
The ComboBox RowSource should have a query or an SQL

statement that has


both the ID column (usually the number) and the

description (the text


part). The ComboBox's BoundColumn property should be
for
the ID, or


numeric, column. This usually means that the text
value
shows in the


ComboBox and the numeric value is stored in the table.

Read the Access


Help article on Combo Boxes for more info.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQJBCl4echKqOuFEgEQKUhgCg2fsa/8g7jMriCOvNjeBGkKJR
w2
cAoLjJ


E/mWwHFaW/ggJ/ATSJ741yn4
=55yF
-----END PGP SIGNATURE-----


James wrote:



I or the user sees text but when I look at the tables

they


are a number value....

How do I get it to look at a number value? but still

have


the cbobox producing the text rather than a number?

Many Thanks

James




-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You might try adding the PARAMETERS clause:

PARAMETERS [Forms]![frmqry]![cboGender] Text,
[Forms]![frmqry]![cboQuestion] Text,
[Forms]![frmqry]![cboAnswer] Text;
SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select

Count


(*) FROM tblResponses) AS ReturnPercentage

FROM tblResponses



WHERE Gender = [Forms]![frmqry]![cboGender]
And Question = [Forms]![frmqry]![cboQuestion]
And Answer = [Forms]![frmqry]![cboAnswer]

The above assumes the data types of each parameter is

TEXT. Change them



to the appropriate data type if necessary.

Of course, you know that the form "frmQry" has to be

open


and the



controls have to have valid values (not null).

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQI641IechKqOuFEgEQJC0gCfUPnHmo/rfz5JTqve9j41IH
ng
Hf


0AoJV0



lKCJD+paDuVnSFNlqKPMmLFK
=4qv7
-----END PGP SIGNATURE-----


James wrote:




Hello there I have the following SQL....

-----------------------------------------------------
--
-


---



SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select

Count



(*) FROM tblResponses) AS ReturnPercentage

FROM tblResponses


WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) And
(([Question])=[Forms]![frmqry]![cboQuestion]) And
(([tblResponses].[Answer])=[Forms]![frmqry]!

[cboAnswer]));



-----------------------------------------------------
--
-


---



Where by when I run the query from the form with

values


in



the cboboxes it asks me to put in the Gender and the
Question again does anyone know why this is?

Also I have tried the following code:

-----------------------------------------------------
--
-


---



SELECT Count(1) AS ReturnCount, 100*Count(1)/(Select

Count



(*) FROM tblResponses) AS ReturnPercentage

FROM tblResponses


WHERE ((([tblResponses].Gender)=[Forms]![frmqry]!
[cboGender]) And (([tblResponses].Question)=[Forms]!
[frmqry]![cboQuestion]) And (([tblResponses].
[Answer])=
[Forms]![frmqry]![cboAnswer]));

-----------------------------------------------------

--
-


---



And I still get the same problem. How can I get it
to
recognise the values? When I type in the values
which
are



correct to the table I get no results returened even
thought there is data in the table.

Many Thanks or any assistence given

James


.


.

.
 
J

James

Hi...

I have run teh query from the database window and I have
put in the numeric values off the table...

I have added the ID fileds into the query and told it to
use teh ID files meaning use the numeric field to run teh
query and it kicks up a fuss and tells me that The data
type is wrong and all I am doing is bounding the column to
the secon field (the ID field). How do I get around this?

Ok the query is not open when the form is open it runs the
query invisibaly in effect.

Yes when I run the query I fill in the cboboxes first and
then ask it to run the query based on the values in the
cboboxes...

Right as I said above if I change the Bound Column it
kicks up a fuss by saying that its teh wrong data type...
I mean I would like the user to see the normal stuff like
the Gender of the male and female and the query see the
numeric values...

I have also set-up the requery command button as well as
you have asked and changed the text box value so that it a
DLOOKUP rather than the DFirst...

I am being mitherd for this so hence I am a little flappy
but many thanks for you assistance it is greatly
appreciated... and very very helpful within my project...

James
-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is the form frmQuery open? Are there any values in the ComboBoxes when
you run the query? Are the BoundColumns of the ComboBoxes set to the
correct column in the ComboBoxes, the numeric value columns? Remember
BoundColumns are 1-based; this means the 1st column is column 1 not 0.

To show the percentage in a TextBox: the easiest way is to use a
DLookup() function in the TextBox's ControlSource property:

ControlSource: =DLookup("ReturnPercentage","QueryName")

Change the QueryName to whatever name you have given the query.

Now, instead of running the query when a button is pushed instead you
Requery the TextBox. That will cause the DLookup() to re- run the query
& get the percentage. You can do the same thing for the ReturnCount -
new TextBox w/ similar ControlSource, just use "ReturnCount" in place of
"ReturnPercentage." E.g.:

Private Sub cmdRequery_Click()

Me!Percentage.Requery
Me!RecordCount.Requery

End Sub

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQJLhpYechKqOuFEgEQKcpQCdGfj7JFG4Q0m8fvXHIVLLMjD2Q2 kAn0ZD
1koFHskA87SuZ3MKm3q+dbL8
=XPSu
-----END PGP SIGNATURE-----

Ok I now have the following:

-------------------------------------------------------- ---

PARAMETERS [Forms]![frmqry]![cboGender] Long, [Forms]!
[frmqry]![cboQuestion] Long, [Forms]![frmqry]! [cboAnswer]
Bit;
SELECT TOP 1 Count(1) AS ReturnCount, 100*Count(1)/ (Select
Count (*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) And
(([Question])=[Forms]![frmqry]![cboQuestion]) And
(([tblResponses].[Answer])=[Forms]![frmqry]! [cboAnswer]))
ORDER BY 2;

-------------------------------------------------------- ---

This work fine... (I think)

When in the form I select values in the actual cboboxes
and click calculate which just simply runs a query for
me...

but for some reason it pops up a box which tells me that I
need to input the Gender and the Question number...

Even when I do this everything is returned as 0

No matter what I put in there... and there is data in teh
actual table of tblResponses....

Also how do I get the percentage to appear in a text box
on my form?

Many Thanks

James


-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The correct PARAMETERS syntax is:

PARAMETERS [Forms]![frmqry]![cboGender] Long ,
[Forms]![frmqry]![cboQuestion] Long ,
[Forms]![frmqry]![cboAnswer] Bit;

An less complex ORDER BY syntax can be:

ORDER BY 2

2 is the 2nd column in the SELECT clause. This can be

used instead of
the complex expression used to create the column 2 value.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQJFikIechKqOuFEgEQJIDACg8KZ/1cRZjwphd1Qk43vcqHME
XD

cAn36B
xOUHc4dB5D2WpFCuSb04Ga+p
=a8K4
-----END PGP SIGNATURE-----


James wrote:


Hi I have done the following:

-------------------------------------------------------
-

---
PARAMETERS [Forms]![frmqry]![cboGender] Number ( Long
Integer ), [Forms]![frmqry]![cboQuestion] Number ( Long
Integer ), [Forms]![frmqry]![cboAnswer] Yes/No
(True/False );
SELECT TOP 1 Count(1) AS ReturnCount, 100*Count(1)/
(Select

Count (*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) AND
(([Question])=[Forms]![frmqry]![cboQuestion]) AND
((tblResponses.Answer)=[Forms]![frmqry]![cboAnswer]))
ORDER BY 100*Count(1)/(Select Count (*) FROM
tblResponses);

-------------------------------------------------------
-

---
Is this correct or do I need to change anything?? as
its

telling me the syntex is wrong the the Parameters bit...

Many Thanks

James



-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If the table shows a numeric value in the column that
is

what is


important. Open the table in design view and read the

data type for


each of the pertinent columns (put the cursor on the
Data

Type column of


the column (Field Name) and in the Field Properties

section, below, read


the Field Size value (one of Integer, Long Integer,

Double, Single,


Byte, Replication ID [for replication only] and Decimal

[in A2K & >

only]). Whatever appears in the Field Size property
put

as the data


type of the associated query parameter (use Long for
Long

Integer).


Read the Access Help articles on data types for more
info.

The ComboBox RowSource should have a query or an SQL

statement that has


both the ID column (usually the number) and the

description (the text


part). The ComboBox's BoundColumn property should be
for

the ID, or


numeric, column. This usually means that the text
value

shows in the


ComboBox and the numeric value is stored in the table.

Read the Access


Help article on Combo Boxes for more info.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQJBCl4echKqOuFEgEQKUhgCg2fsa/8g7jMriCOvNjeBGkK
JR

w2
cAoLjJ


E/mWwHFaW/ggJ/ATSJ741yn4
=55yF
-----END PGP SIGNATURE-----


James wrote:



I or the user sees text but when I look at the tables

they


are a number value....

How do I get it to look at a number value? but still

have


the cbobox producing the text rather than a number?

Many Thanks

James




-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You might try adding the PARAMETERS clause:

PARAMETERS [Forms]![frmqry]![cboGender] Text,
[Forms]![frmqry]![cboQuestion] Text,
[Forms]![frmqry]![cboAnswer] Text;
SELECT Count(1) AS ReturnCount, 100*Count(1)/ (Select

Count


(*) FROM tblResponses) AS ReturnPercentage

FROM tblResponses



WHERE Gender = [Forms]![frmqry]![cboGender]
And Question = [Forms]![frmqry]![cboQuestion]
And Answer = [Forms]![frmqry]![cboAnswer]

The above assumes the data types of each parameter is

TEXT. Change them



to the appropriate data type if necessary.

Of course, you know that the form "frmQry" has to be

open


and the



controls have to have valid values (not null).

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQI641IechKqOuFEgEQJC0gCfUPnHmo/rfz5JTqve9j41
IH

ng
Hf


0AoJV0



lKCJD+paDuVnSFNlqKPMmLFK
=4qv7
-----END PGP SIGNATURE-----


James wrote:




Hello there I have the following SQL....

---------------------------------------------------
--

--
-


---



SELECT Count(1) AS ReturnCount, 100*Count(1)/ (Select

Count



(*) FROM tblResponses) AS ReturnPercentage

FROM tblResponses


WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) And
(([Question])=[Forms]![frmqry]![cboQuestion]) And
(([tblResponses].[Answer])=[Forms]![frmqry]!

[cboAnswer]));



---------------------------------------------------
--

--
-


---



Where by when I run the query from the form with

values


in



the cboboxes it asks me to put in the Gender and the
Question again does anyone know why this is?

Also I have tried the following code:

---------------------------------------------------
--

--
-


---



SELECT Count(1) AS ReturnCount, 100*Count(1)/ (Select

Count



(*) FROM tblResponses) AS ReturnPercentage

FROM tblResponses


WHERE ((([tblResponses].Gender)=[Forms]![frmqry]!
[cboGender]) And (([tblResponses].Question)= [Forms]!
[frmqry]![cboQuestion]) And (([tblResponses].
[Answer])=

[Forms]![frmqry]![cboAnswer]));

---------------------------------------------------
--

--
-


---



And I still get the same problem. How can I get it
to

recognise the values? When I type in the values
which

are



correct to the table I get no results returened even
thought there is data in the table.

Many Thanks or any assistence given

James


.


.


.

.
 
J

James

Hello I have not got it to work....

I would like now for it to just show the result to 2
decimal places how do I get it to do this?

I have set the input mask on the txt box as 99.99 but it
seems to go for something like 2.0833333333333333333333

How do I achieve my goal and then its all finished!! YAY!!

Many Thanks

James
-----Original Message-----
Hi...

I have run teh query from the database window and I have
put in the numeric values off the table...

I have added the ID fileds into the query and told it to
use teh ID files meaning use the numeric field to run teh
query and it kicks up a fuss and tells me that The data
type is wrong and all I am doing is bounding the column to
the secon field (the ID field). How do I get around this?

Ok the query is not open when the form is open it runs the
query invisibaly in effect.

Yes when I run the query I fill in the cboboxes first and
then ask it to run the query based on the values in the
cboboxes...

Right as I said above if I change the Bound Column it
kicks up a fuss by saying that its teh wrong data type...
I mean I would like the user to see the normal stuff like
the Gender of the male and female and the query see the
numeric values...

I have also set-up the requery command button as well as
you have asked and changed the text box value so that it a
DLOOKUP rather than the DFirst...

I am being mitherd for this so hence I am a little flappy
but many thanks for you assistance it is greatly
appreciated... and very very helpful within my project...

James
-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is the form frmQuery open? Are there any values in the ComboBoxes when
you run the query? Are the BoundColumns of the ComboBoxes set to the
correct column in the ComboBoxes, the numeric value columns? Remember
BoundColumns are 1-based; this means the 1st column is column 1 not 0.

To show the percentage in a TextBox: the easiest way is to use a
DLookup() function in the TextBox's ControlSource property:

ControlSource: =DLookup("ReturnPercentage","QueryName")

Change the QueryName to whatever name you have given the query.

Now, instead of running the query when a button is
pushed
instead you
Requery the TextBox. That will cause the DLookup() to
re-
run the query
& get the percentage. You can do the same thing for the ReturnCount -
new TextBox w/ similar ControlSource, just use "ReturnCount" in place of
"ReturnPercentage." E.g.:

Private Sub cmdRequery_Click()

Me!Percentage.Requery
Me!RecordCount.Requery

End Sub

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQJLhpYechKqOuFEgEQKcpQCdGfj7JFG4Q0m8fvXHIVLLMjD2Q
2
kAn0ZD
1koFHskA87SuZ3MKm3q+dbL8
=XPSu
-----END PGP SIGNATURE-----
-
---
PARAMETERS [Forms]![frmqry]![cboGender] Long, [Forms]!
[frmqry]![cboQuestion] Long, [Forms]![frmqry]! [cboAnswer]
Bit;
SELECT TOP 1 Count(1) AS ReturnCount, 100*Count(1)/ (Select
Count (*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) And
(([Question])=[Forms]![frmqry]![cboQuestion]) And
(([tblResponses].[Answer])=[Forms]![frmqry]! [cboAnswer]))
ORDER BY 2;

-------------------------------------------------------
-
---
This work fine... (I think)

When in the form I select values in the actual cboboxes
and click calculate which just simply runs a query for
me...

but for some reason it pops up a box which tells me that I
need to input the Gender and the Question number...

Even when I do this everything is returned as 0

No matter what I put in there... and there is data in teh
actual table of tblResponses....

Also how do I get the percentage to appear in a text box
on my form?

Many Thanks

James



-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The correct PARAMETERS syntax is:

PARAMETERS [Forms]![frmqry]![cboGender] Long ,
[Forms]![frmqry]![cboQuestion] Long ,
[Forms]![frmqry]![cboAnswer] Bit;

An less complex ORDER BY syntax can be:

ORDER BY 2

2 is the 2nd column in the SELECT clause. This can be

used instead of

the complex expression used to create the column 2 value.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQJFikIechKqOuFEgEQJIDACg8KZ/1cRZjwphd1Qk43vcqHM
E
-
-
---

PARAMETERS [Forms]![frmqry]![cboGender] Number ( Long
Integer ), [Forms]![frmqry]![cboQuestion] Number ( Long
Integer ), [Forms]![frmqry]![cboAnswer] Yes/No
(True/False );
SELECT TOP 1 Count(1) AS ReturnCount, 100*Count(1)/

(Select

Count (*) FROM tblResponses) AS ReturnPercentage
FROM tblResponses
WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) AND
(([Question])=[Forms]![frmqry]![cboQuestion]) AND
((tblResponses.Answer)=[Forms]![frmqry]![cboAnswer]))
ORDER BY 100*Count(1)/(Select Count (*) FROM

tblResponses);

------------------------------------------------------
-
-
---

Is this correct or do I need to change anything?? as

its

telling me the syntex is wrong the the Parameters bit...

Many Thanks

James



-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If the table shows a numeric value in the column that

is

what is


important. Open the table in design view and read the

data type for


each of the pertinent columns (put the cursor on the

Data

Type column of


the column (Field Name) and in the Field Properties

section, below, read


the Field Size value (one of Integer, Long Integer,

Double, Single,


Byte, Replication ID [for replication only] and Decimal

[in A2K & >

only]). Whatever appears in the Field Size property

put

as the data


type of the associated query parameter (use Long for

Long

Integer).


Read the Access Help articles on data types for more

info.

The ComboBox RowSource should have a query or an SQL

statement that has


both the ID column (usually the number) and the

description (the text


part). The ComboBox's BoundColumn property should be

for

the ID, or


numeric, column. This usually means that the text

value

shows in the


ComboBox and the numeric value is stored in the table.

Read the Access


Help article on Combo Boxes for more info.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQJBCl4echKqOuFEgEQKUhgCg2fsa/8g7jMriCOvNjeBGk
K
JR
w2

cAoLjJ


E/mWwHFaW/ggJ/ATSJ741yn4
=55yF
-----END PGP SIGNATURE-----


James wrote:



I or the user sees text but when I look at the tables

they


are a number value....

How do I get it to look at a number value? but still

have


the cbobox producing the text rather than a number?

Many Thanks

James




-----Original Message-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You might try adding the PARAMETERS clause:

PARAMETERS [Forms]![frmqry]![cboGender] Text,
[Forms]![frmqry]![cboQuestion] Text,
[Forms]![frmqry]![cboAnswer] Text;
SELECT Count(1) AS ReturnCount, 100*Count(1)/ (Select

Count


(*) FROM tblResponses) AS ReturnPercentage

FROM tblResponses



WHERE Gender = [Forms]![frmqry]![cboGender]
And Question = [Forms]![frmqry]![cboQuestion]
And Answer = [Forms]![frmqry]![cboAnswer]

The above assumes the data types of each parameter is

TEXT. Change them



to the appropriate data type if necessary.

Of course, you know that the form "frmQry" has to be

open


and the



controls have to have valid values (not null).

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQI641IechKqOuFEgEQJC0gCfUPnHmo/rfz5JTqve9j4
1
-
--
--

-


---



SELECT Count(1) AS ReturnCount, 100*Count(1)/ (Select

Count



(*) FROM tblResponses) AS ReturnPercentage

FROM tblResponses


WHERE ((([Gender])=[Forms]![frmqry]![cboGender]) And
(([Question])=[Forms]![frmqry]![cboQuestion]) And
(([tblResponses].[Answer])=[Forms]![frmqry]!

[cboAnswer]));



--------------------------------------------------
-
-
--
--

-


---



SELECT Count(1) AS ReturnCount, 100*Count(1)/ (Select

Count



(*) FROM tblResponses) AS ReturnPercentage

FROM tblResponses


WHERE ((([tblResponses].Gender)=[Forms]![frmqry]!
[cboGender]) And (([tblResponses].Question)= [Forms]!
[frmqry]![cboQuestion]) And (([tblResponses].

[Answer])=

[Forms]![frmqry]![cboAnswer]));

--------------------------------------------------
-.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top