Successful Tick Box

D

dan.cawthorne

Hi Again,

Simple Question


Ive created a query and i have a tick box called "Successful" located
in a tabel called projects.

what i want to be able to do is on a dialog form, is when the tick box
is ticked it also shows the Successful projects,between the two dates
i searched between, of course some one has to assign a tick the
project.

but if i leave the tick out on the dialog, it just show me all the
projects between the date and not show the Successful projects

at moment i've only got to work by just showing only Successful
projects or non Successful projects.

how do i get it all ways show the non Successful projects but add in
the Successful projects when the tick is applied on the dialog form?
 
D

Dale Fye

Dan,

If the only time you run this query is for this form, then you could use a
where clause that looks something like:

WHERE [yourTable].[Successful] = False
OR (Forms!yourForm.chk_IncludeSuccessful = True)

replace "yourTable", "yourForm", "[Successsful]", and
"chk_IncludeSuccessful" with the appropriate table, field, form, and control
names from your application.

This will return all of the "unsuccessful" values if the checkbox is not
checked, and the successful ones when it is.

Another option would be to use an option group rather than the check box,
with options for All (1), Unsuccessful (0), and Successful (-1); the numbers
in paren are the option values.

The where clause for this might look like:
WHERE [yourTable].Successful = Forms!yourForm.ogSuccessful
OR (Forms!yourForm.ogSuccessful = 1)

I actually prefer this to the checkbox. If you want to normally list the
Unsuccessful ones, just set the option groups default value to 0.

HTH
Dale
 
D

dan.cawthorne

Dan,

If the only time you run this query is for this form, then you could use a
where clause that looks something like:

WHERE [yourTable].[Successful] = False
OR (Forms!yourForm.chk_IncludeSuccessful = True)

replace "yourTable", "yourForm", "[Successsful]", and
"chk_IncludeSuccessful" with the appropriate table, field, form, and control
names from your application.

This will return all of the "unsuccessful" values if the checkbox is not
checked, and the successful ones when it is.

Another option would be to use an option group rather than the check box,
with options for All (1), Unsuccessful (0), and Successful (-1); the numbers
in paren are the option values.

The where clause for this might look like:
WHERE [yourTable].Successful = Forms!yourForm.ogSuccessful
OR (Forms!yourForm.ogSuccessful = 1)

I actually prefer this to the checkbox. If you want to normally list the
Unsuccessful ones, just set the option groups default value to 0.

HTH
Dale
--
Email address is not valid.
Please reply to newsgroup only.

Hi Again,
Simple Question
Ive created a query and i have a tick box called "Successful" located
in a tabel called projects.
what i want to be able to do is on a dialog form, is when the tick box
is ticked it also shows the Successful projects,between the two dates
i searched between, of course some one has to assign a tick the
project.
but if i leave the tick out on the dialog, it just show me all the
projects between the date and not show the Successful projects
at moment i've only got to work by just showing only Successful
projects or non Successful projects.
how do i get it all ways show the non Successful projects but add in
the Successful projects when the tick is applied on the dialog form?

Forgot to mention Dale,

The Dialog form as command button that opens a report not a form, do
this make any difference to you suggestion?

Cause I moment I've left the Tick box criteria blank at moment.
 
D

Dale Fye

No, it does not make any difference. Although with reports, I tend to create
the query that supports the report without any criteria(would list all
records), then, when I open the report, I use the WhereCondition parameter to
pass the filter that would restrict the values. It would look something like:

Private sub cmd_Report_Click

Dim strCriteria as string

strCriteria = "[Successful] = False " _
& "OR (" & Forms!yourForm.chk_IncludeSuccessful & " =
True)"
docmd.openreport "rpt_YourReport",,,strCriteria

End sub

HTH
Dale
--
Email address is not valid.
Please reply to newsgroup only.


Dan,

If the only time you run this query is for this form, then you could use a
where clause that looks something like:

WHERE [yourTable].[Successful] = False
OR (Forms!yourForm.chk_IncludeSuccessful = True)

replace "yourTable", "yourForm", "[Successsful]", and
"chk_IncludeSuccessful" with the appropriate table, field, form, and control
names from your application.

This will return all of the "unsuccessful" values if the checkbox is not
checked, and the successful ones when it is.

Another option would be to use an option group rather than the check box,
with options for All (1), Unsuccessful (0), and Successful (-1); the numbers
in paren are the option values.

The where clause for this might look like:
WHERE [yourTable].Successful = Forms!yourForm.ogSuccessful
OR (Forms!yourForm.ogSuccessful = 1)

I actually prefer this to the checkbox. If you want to normally list the
Unsuccessful ones, just set the option groups default value to 0.

HTH
Dale
--
Email address is not valid.
Please reply to newsgroup only.

Hi Again,
Simple Question
Ive created a query and i have a tick box called "Successful" located
in a tabel called projects.
what i want to be able to do is on a dialog form, is when the tick box
is ticked it also shows the Successful projects,between the two dates
i searched between, of course some one has to assign a tick the
project.
but if i leave the tick out on the dialog, it just show me all the
projects between the date and not show the Successful projects
at moment i've only got to work by just showing only Successful
projects or non Successful projects.
how do i get it all ways show the non Successful projects but add in
the Successful projects when the tick is applied on the dialog form?

Forgot to mention Dale,

The Dialog form as command button that opens a report not a form, do
this make any difference to you suggestion?

Cause I moment I've left the Tick box criteria blank at moment.
 
D

dan.cawthorne

Dan,

If the only time you run this query is for this form, then you could use a
where clause that looks something like:

WHERE [yourTable].[Successful] = False
OR (Forms!yourForm.chk_IncludeSuccessful = True)

replace "yourTable", "yourForm", "[Successsful]", and
"chk_IncludeSuccessful" with the appropriate table, field, form, and control
names from your application.

This will return all of the "unsuccessful" values if the checkbox is not
checked, and the successful ones when it is.

Another option would be to use an option group rather than the check box,
with options for All (1), Unsuccessful (0), and Successful (-1); the numbers
in paren are the option values.

The where clause for this might look like:
WHERE [yourTable].Successful = Forms!yourForm.ogSuccessful
OR (Forms!yourForm.ogSuccessful = 1)

I actually prefer this to the checkbox. If you want to normally list the
Unsuccessful ones, just set the option groups default value to 0.

HTH
Dale
--
Email address is not valid.
Please reply to newsgroup only.

Hi Again,
Simple Question
Ive created a query and i have a tick box called "Successful" located
in a tabel called projects.
what i want to be able to do is on a dialog form, is when the tick box
is ticked it also shows the Successful projects,between the two dates
i searched between, of course some one has to assign a tick the
project.
but if i leave the tick out on the dialog, it just show me all the
projects between the date and not show the Successful projects
at moment i've only got to work by just showing only Successful
projects or non Successful projects.
how do i get it all ways show the non Successful projects but add in
the Successful projects when the tick is applied on the dialog form?

Just added this WHERE clause the the Query.

WHERE [Projects]![Successful] OR (Forms![Weekly Project Report]!
[chk_IncludeSuccessful] = True)

for some unknown reason regardless if i tick the check box on form
Weekly Project Report It it still shows all the projects. regardless
if that have a tick in the [Successful] Field
 
D

Dale Fye

Dan,

You need to add some code to the AfterUpdate event of the form to requery it.

Actually, the way that were clause is written, I'd be surprised if it gave
you any of the unsuccessful records. It should read:

WHERE [Projects]![Successful] = FALSE
OR (Forms![Weekly Project Report]![chk_IncludeSuccessful] = True)

Is your checkbox actually named "chk_IncludeSuccessful"?

--
Email address is not valid.
Please reply to newsgroup only.


Dan,

If the only time you run this query is for this form, then you could use a
where clause that looks something like:

WHERE [yourTable].[Successful] = False
OR (Forms!yourForm.chk_IncludeSuccessful = True)

replace "yourTable", "yourForm", "[Successsful]", and
"chk_IncludeSuccessful" with the appropriate table, field, form, and control
names from your application.

This will return all of the "unsuccessful" values if the checkbox is not
checked, and the successful ones when it is.

Another option would be to use an option group rather than the check box,
with options for All (1), Unsuccessful (0), and Successful (-1); the numbers
in paren are the option values.

The where clause for this might look like:
WHERE [yourTable].Successful = Forms!yourForm.ogSuccessful
OR (Forms!yourForm.ogSuccessful = 1)

I actually prefer this to the checkbox. If you want to normally list the
Unsuccessful ones, just set the option groups default value to 0.

HTH
Dale
--
Email address is not valid.
Please reply to newsgroup only.

Hi Again,
Simple Question
Ive created a query and i have a tick box called "Successful" located
in a tabel called projects.
what i want to be able to do is on a dialog form, is when the tick box
is ticked it also shows the Successful projects,between the two dates
i searched between, of course some one has to assign a tick the
project.
but if i leave the tick out on the dialog, it just show me all the
projects between the date and not show the Successful projects
at moment i've only got to work by just showing only Successful
projects or non Successful projects.
how do i get it all ways show the non Successful projects but add in
the Successful projects when the tick is applied on the dialog form?

Just added this WHERE clause the the Query.

WHERE [Projects]![Successful] OR (Forms![Weekly Project Report]!
[chk_IncludeSuccessful] = True)

for some unknown reason regardless if i tick the check box on form
Weekly Project Report It it still shows all the projects. regardless
if that have a tick in the [Successful] Field
 
D

dan.cawthorne

If the only time you run this query is for this form, then you could use a
where clause that looks something like:
WHERE [yourTable].[Successful] = False
OR (Forms!yourForm.chk_IncludeSuccessful = True)
replace "yourTable", "yourForm", "[Successsful]", and
"chk_IncludeSuccessful" with the appropriate table, field, form, and control
names from your application.
This will return all of the "unsuccessful" values if the checkbox is not
checked, and the successful ones when it is.
Another option would be to use an option group rather than the check box,
with options for All (1), Unsuccessful (0), and Successful (-1); the numbers
in paren are the option values.
The where clause for this might look like:
WHERE [yourTable].Successful = Forms!yourForm.ogSuccessful
OR (Forms!yourForm.ogSuccessful = 1)
I actually prefer this to the checkbox. If you want to normally list the
Unsuccessful ones, just set the option groups default value to 0.

Just added this WHERE clause the the Query.

WHERE [Projects]![Successful] OR (Forms![Weekly Project Report]!
[chk_IncludeSuccessful] = True)

for some unknown reason regardless if i tick the check box on form
Weekly Project Report It it still shows all the projects. regardless
if that have a tick in the [Successful] Field

Dont worry about the last post,

i used the filter in the onclick event of the button as follows

Private Sub Command1_Click()

Dim strCriteria As String

strCriteria = "[Successful] = False " _
& "OR (" & Forms![Weekly Project
Report].chk_IncludeSuccessful & " = True)"
DoCmd.OpenReport "Weekly Active Project List", acViewPreview, ,
strCriteria

End Sub

And it Seems to do that job Touch wood

Thanks
 

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