By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,933 Members | 1,223 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,933 IT Pros & Developers. It's quick & easy.

printing Yes, No, Maybe from the numbers 1, 2, and 3 using an Access report

P: n/a
Hi, I have an report in Microsoft Access and it displays everything in
the table. One column called "DECISION" in the table has either 1,2,
or 3 in it. On my report it displays 1, 2, or 3. I want to appear in
the report is Yes, No, or Maybe. What do I need to do to change what
appears in the report/what term do I need to search out in Google?
Thank you
Colin
Nov 13 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Put the following expression in an empty field in the query your report is based
on:

TxtDecision:Switch([Decision]=1,"Yes",[Decision]=2,"No",[Decision]=3,"Maybe")

Then add TxtDecision as a field in your report.

Note: If 1, 2 and 3 are text, then enclose them in quotes in the Switch
expression.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Colin McGuire" <co***********@lycos.co.uk> wrote in message
news:ab**************************@posting.google.c om...
Hi, I have an report in Microsoft Access and it displays everything in
the table. One column called "DECISION" in the table has either 1,2,
or 3 in it. On my report it displays 1, 2, or 3. I want to appear in
the report is Yes, No, or Maybe. What do I need to do to change what
appears in the report/what term do I need to search out in Google?
Thank you
Colin

Nov 13 '05 #2

P: n/a
On 30 Jul 2004 07:08:52 -0700, Colin McGuire wrote:
Hi, I have an report in Microsoft Access and it displays everything in
the table. One column called "DECISION" in the table has either 1,2,
or 3 in it. On my report it displays 1, 2, or 3. I want to appear in
the report is Yes, No, or Maybe. What do I need to do to change what
appears in the report/what term do I need to search out in Google?
Thank you
Colin


In your report, add an unbound control to the report.
Set it's control source to:
=Choose([Decision],"Yes","No","Maybe")
or ....
You could also use:
=IIf([Decision]=1,"Yes",IIf([Decision]=2,"No","Maybe"))
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #3

P: n/a
Someone out there is going to give you a nested IIF statement that is
going to work really nicely. In case they don't try this.

Create a function in a module like this:

Public Function YNM(i As Integer) As String
'YesNoMaybe
Dim strResponse As String

Select Case i
Case 1
strResponse = "Yes"

Case 2
strResponse = "No"

Case 3
strResponse = "Maybe"

End Select

YNM = strResponse

End Function

Then create a query with a calculated field

DecisionText: YNM([Decision])

The SQL for this would be

SELECT tblMyTable.Decision, YNM([Decision]) AS DecisionText
FROM tblMyTable;

That ought to do it! Any questions post again.

If you don't like my solution try looking up Nested IIF's in a query
on Google.

co***********@lycos.co.uk (Colin McGuire) wrote in message news:<ab**************************@posting.google. com>...
Hi, I have an report in Microsoft Access and it displays everything in
the table. One column called "DECISION" in the table has either 1,2,
or 3 in it. On my report it displays 1, 2, or 3. I want to appear in
the report is Yes, No, or Maybe. What do I need to do to change what
appears in the report/what term do I need to search out in Google?
Thank you
Colin

Nov 13 '05 #4

P: n/a
Thanks for the ways of doing this.

I want to do it like this though.

I want to put an unbound control like a textbox on the report and then
set the "Yes", "No", "Maybe" using VBA. Can this be done?

Here is what I have that isn't working rather than the whole thing.

1. I put a new textbox on the report (called Text51)
2. I have the following in the "Report_Page" event.

Private Sub Report_Page()
Text51.Text="something" 'will be one of Yes,No,Maybe with some VBA
End Sub 'once I get this little bit working.

Text51 doesn't seem to have a Text or Value property and VBA is giving
me an error.


du********@aol.com (Ed Marzan) wrote in message news:<cc**************************@posting.google. com>...
Someone out there is going to give you a nested IIF statement that is
going to work really nicely. In case they don't try this.

Create a function in a module like this:

Public Function YNM(i As Integer) As String
'YesNoMaybe
Dim strResponse As String

Select Case i
Case 1
strResponse = "Yes"

Case 2
strResponse = "No"

Case 3
strResponse = "Maybe"

End Select

YNM = strResponse

End Function

Then create a query with a calculated field

DecisionText: YNM([Decision])

The SQL for this would be

SELECT tblMyTable.Decision, YNM([Decision]) AS DecisionText
FROM tblMyTable;

That ought to do it! Any questions post again.

If you don't like my solution try looking up Nested IIF's in a query
on Google.

co***********@lycos.co.uk (Colin McGuire) wrote in message news:<ab**************************@posting.google. com>...
Hi, I have an report in Microsoft Access and it displays everything in
the table. One column called "DECISION" in the table has either 1,2,
or 3 in it. On my report it displays 1, 2, or 3. I want to appear in
the report is Yes, No, or Maybe. What do I need to do to change what
appears in the report/what term do I need to search out in Google?
Thank you
Colin

Nov 13 '05 #5

P: n/a
On 31 Jul 2004 00:03:31 -0700, Colin McGuire wrote:
Thanks for the ways of doing this.

I want to do it like this though.

I want to put an unbound control like a textbox on the report and then
set the "Yes", "No", "Maybe" using VBA. Can this be done?

Here is what I have that isn't working rather than the whole thing.

1. I put a new textbox on the report (called Text51)
2. I have the following in the "Report_Page" event.

Private Sub Report_Page()
Text51.Text="something" 'will be one of Yes,No,Maybe with some VBA
End Sub 'once I get this little bit working.

Text51 doesn't seem to have a Text or Value property and VBA is giving
me an error.

du********@aol.com (Ed Marzan) wrote in message news:<cc**************************@posting.google. com>...
Someone out there is going to give you a nested IIF statement that is
going to work really nicely. In case they don't try this.

Create a function in a module like this:

Public Function YNM(i As Integer) As String
'YesNoMaybe
Dim strResponse As String

Select Case i
Case 1
strResponse = "Yes"

Case 2
strResponse = "No"

Case 3
strResponse = "Maybe"

End Select

YNM = strResponse

End Function

Then create a query with a calculated field

DecisionText: YNM([Decision])

The SQL for this would be

SELECT tblMyTable.Decision, YNM([Decision]) AS DecisionText
FROM tblMyTable;

That ought to do it! Any questions post again.

If you don't like my solution try looking up Nested IIF's in a query
on Google.

co***********@lycos.co.uk (Colin McGuire) wrote in message news:<ab**************************@posting.google. com>...
Hi, I have an report in Microsoft Access and it displays everything in
the table. One column called "DECISION" in the table has either 1,2,
or 3 in it. On my report it displays 1, 2, or 3. I want to appear in
the report is Yes, No, or Maybe. What do I need to do to change what
appears in the report/what term do I need to search out in Google?
Thank you
Colin


1) If it is a text control (unbound or otherwise) it does have a Value
property.
It's what ever value is returned by the control's control source, i,e,
= "This is it's value.", or a value in a bound field.

2) You're getting your error because you're using the wrong event.
Why are you attempting this in the Page event?

3) Where have you placed the unbound control [Text51]?
In the Detail Section?
Code the Detail Format event:
[Text51] =Choose([Decision],"Yes","No","Maybe")

I don't see any advantage to using code to write the value as opposed
to simply placing the expression directly into the control's control
source, as long as the [Decision] field is a field in the report's
record source.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #6

P: n/a

Thanks for your quick help. Here are more questions because I still can't
get this simple thing going.
2) You're getting your error because you're using the wrong event.
Why are you attempting this in the Page event?
What other event should it be/should I use? (I am not trying to be being
cute, I just don't know) Every row that is printed I want to determine Yes,
No, or Maybe from a number. This subroutine is called (see my "test" below)
every time a new row in the table is used for the report.

The reason I want to do it in VBA rather than using things like this
("[Text51] =Choose([Decision],"Yes","No","Maybe")") is that I know VBA and
although it doesn't look too cryptic, I still want to avoid the hassle of
finding out how to use the syntax/query builder etc
3) Where have you placed the unbound control [Text51]?
In the Detail Section? Yes.

When I type in the following (you suggested using the Value property),
"anything" does not appear on the report but a message box is displayed with
"test" in it for every row in the table meaning the it is called correctly.

Private Sub Report_Page()
MsgBox "test"
Text51.Value = "anything"

So no further ahead.

When you sum it all up, I want to set what appears in the textbox on a
report using VBA at runtime. The Yes, No, Maybe bit is a bit of a red
herring.

Thank you again for this and future help.
Colin
"fredg" <fg******@example.invalid> wrote in message
news:uc****************************@40tude.net... On 31 Jul 2004 00:03:31 -0700, Colin McGuire wrote:
Thanks for the ways of doing this.

I want to do it like this though.

I want to put an unbound control like a textbox on the report and then
set the "Yes", "No", "Maybe" using VBA. Can this be done?

Here is what I have that isn't working rather than the whole thing.

1. I put a new textbox on the report (called Text51)
2. I have the following in the "Report_Page" event.

Private Sub Report_Page()
Text51.Text="something" 'will be one of Yes,No,Maybe with some VBA
End Sub 'once I get this little bit working.

Text51 doesn't seem to have a Text or Value property and VBA is giving
me an error.

du********@aol.com (Ed Marzan) wrote in message news:<cc**************************@posting.google. com>...
Someone out there is going to give you a nested IIF statement that is
going to work really nicely. In case they don't try this.

Create a function in a module like this:

Public Function YNM(i As Integer) As String
'YesNoMaybe
Dim strResponse As String

Select Case i
Case 1
strResponse = "Yes"

Case 2
strResponse = "No"

Case 3
strResponse = "Maybe"

End Select

YNM = strResponse

End Function

Then create a query with a calculated field

DecisionText: YNM([Decision])

The SQL for this would be

SELECT tblMyTable.Decision, YNM([Decision]) AS DecisionText
FROM tblMyTable;

That ought to do it! Any questions post again.

If you don't like my solution try looking up Nested IIF's in a query
on Google.

co***********@lycos.co.uk (Colin McGuire) wrote in message news:<ab**************************@posting.google. com>... Hi, I have an report in Microsoft Access and it displays everything in
the table. One column called "DECISION" in the table has either 1,2,
or 3 in it. On my report it displays 1, 2, or 3. I want to appear in
the report is Yes, No, or Maybe. What do I need to do to change what
appears in the report/what term do I need to search out in Google?
Thank you
Colin


1) If it is a text control (unbound or otherwise) it does have a Value
property.
It's what ever value is returned by the control's control source, i,e,
= "This is it's value.", or a value in a bound field.

2) You're getting your error because you're using the wrong event.
Why are you attempting this in the Page event?

3) Where have you placed the unbound control [Text51]?
In the Detail Section?
Code the Detail Format event:
[Text51] =Choose([Decision],"Yes","No","Maybe")

I don't see any advantage to using code to write the value as opposed
to simply placing the expression directly into the control's control
source, as long as the [Decision] field is a field in the report's
record source.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Nov 13 '05 #7

P: n/a

Please see my comments interspersed with your questions below.

On Sat, 31 Jul 2004 18:14:30 +0100, Colin McGuire wrote:
Thanks for your quick help. Here are more questions because I still can't
get this simple thing going.
2) You're getting your error because you're using the wrong event.
Why are you attempting this in the Page event?
What other event should it be/should I use? (I am not trying to be being
cute, I just don't know) Every row that is printed I want to determine Yes,
No, or Maybe from a number. This subroutine is called (see my "test" below)
every time a new row in the table is used for the report.


I specifically answered this in my reply, quoted below ....

* 3) Where have you placed the unbound control [Text51]?
* In the Detail Section?
* **** Code the Detail Format event: ****
* [Text51] =Choose([Decision],"Yes","No","Maybe")

If the control is placed in the Detail section, you place the code in
the Detail Format event.
The reason I want to do it in VBA rather than using things like this
("[Text51] =Choose([Decision],"Yes","No","Maybe")") is that I know VBA and
although it doesn't look too cryptic, I don't understand this above comment.
The statement:
[Text51] =Choose([Decision],"Yes","No","Maybe")
placed in an event code IS VBA, which you say you know.
I still want to avoid the hassle of
finding out how to use the syntax/query builder etc What hassle? Why the query builder?
If you wish to get an unbound control to display a value, you write
the expression directly into it's control source.
I gave you previously 2 expressions, either one of which will work.
You write it, exactly as I gave it to you, directly on the control's
control source property line, either:

=Choose([Decision],"Yes","No","Maybe")
or
=IIf([Decision]=1,"Yes",IIf([Decision]=2,"No","Maybe"))

3) Where have you placed the unbound control [Text51]?
In the Detail Section?

Yes.

When I type in the following (you suggested using the Value property),
"anything" does not appear on the report but a message box is displayed with
"test" in it for every row in the table meaning the it is called correctly.


No I didn't suggest using the value property.
I suggested you write:
=Choose([Decision],"Yes","No","Maybe")
as the controls Source property of the unbound control.
The Choose function then returns a value to the control, either "Yes",
"No", or "Maybe", depending upon the value in the [Decision] field.
Private Sub Report_Page()
MsgBox "test"
Text51.Value = "anything"
You're problem, using the Page event, is that you can't change a
control's value in the Page event. It's too late. You have to use the
Detail Format (or Print) event. I use the Format event.
So no further ahead.

When you sum it all up, I want to set what appears in the textbox on a
report using VBA at runtime. The Yes, No, Maybe bit is a bit of a red
herring.
I'll give it to you once more.
If you wish an unbound control, placed in the report's detail section,
to print specific words in place of numbers, either one of these two
things will work.

1) As the CONTROLSOURCE of an unbound control placed in the Report's
Detail section, write:
=Choose([Decision],"Yes","No","Maybe")

or, using code ...

2) Use code, placed in the DETAIL FORMAT event:
[Text51] = Choose([Decision],"Yes","No","Maybe")

Thank you again for this and future help.
Colin

"fredg" <fg******@example.invalid> wrote in message
news:uc****************************@40tude.net...
On 31 Jul 2004 00:03:31 -0700, Colin McGuire wrote:
Thanks for the ways of doing this.

I want to do it like this though.

I want to put an unbound control like a textbox on the report and then
set the "Yes", "No", "Maybe" using VBA. Can this be done?

Here is what I have that isn't working rather than the whole thing.

1. I put a new textbox on the report (called Text51)
2. I have the following in the "Report_Page" event.

Private Sub Report_Page()
Text51.Text="something" 'will be one of Yes,No,Maybe with some VBA
End Sub 'once I get this little bit working.

Text51 doesn't seem to have a Text or Value property and VBA is giving
me an error.

du********@aol.com (Ed Marzan) wrote in message news:<cc**************************@posting.google. com>... Someone out there is going to give you a nested IIF statement that is
going to work really nicely. In case they don't try this.

Create a function in a module like this:

Public Function YNM(i As Integer) As String
'YesNoMaybe
Dim strResponse As String

Select Case i
Case 1
strResponse = "Yes"

Case 2
strResponse = "No"

Case 3
strResponse = "Maybe"

End Select

YNM = strResponse

End Function

Then create a query with a calculated field

DecisionText: YNM([Decision])

The SQL for this would be

SELECT tblMyTable.Decision, YNM([Decision]) AS DecisionText
FROM tblMyTable;

That ought to do it! Any questions post again.

If you don't like my solution try looking up Nested IIF's in a query
on Google.

co***********@lycos.co.uk (Colin McGuire) wrote in message news:<ab**************************@posting.google. com>...> Hi, I have an report in Microsoft Access and it displays everything in
> the table. One column called "DECISION" in the table has either 1,2,
> or 3 in it. On my report it displays 1, 2, or 3. I want to appear in
> the report is Yes, No, or Maybe. What do I need to do to change what
> appears in the report/what term do I need to search out in Google?
> Thank you
> Colin


1) If it is a text control (unbound or otherwise) it does have a Value
property.
It's what ever value is returned by the control's control source, i,e,
= "This is it's value.", or a value in a bound field.

2) You're getting your error because you're using the wrong event.
Why are you attempting this in the Page event?

3) Where have you placed the unbound control [Text51]?
In the Detail Section?
Code the Detail Format event:
[Text51] =Choose([Decision],"Yes","No","Maybe")

I don't see any advantage to using code to write the value as opposed
to simply placing the expression directly into the control's control
source, as long as the [Decision] field is a field in the report's
record source.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #8

P: n/a
You don't (?) normally change the value of a text box in a report.
What you do is Set the Control Source, and the value comes from the
control source. You can only set the control source before the
report is displayed (in the open event normally).

Or you can set the caption on a label.

For what you are doing, using label.caption seems to be appropriate.

For more complex situations, you may wish to set the control source
of a text box to something like "=localfuncTextValue(idxRecord,idxValue)"
Which is more or less equivalent to using a function in the query,
but allows you to use a VBA function that is in the report module,
and lets you put different functions on different controls.

(david)
"Colin McGuire" <co***********@lycos.co.uk> wrote in message
news:10****************@lotis.uk.clara.net...

Thanks for your quick help. Here are more questions because I still can't
get this simple thing going.
2) You're getting your error because you're using the wrong event.
Why are you attempting this in the Page event?
What other event should it be/should I use? (I am not trying to be being
cute, I just don't know) Every row that is printed I want to determine

Yes, No, or Maybe from a number. This subroutine is called (see my "test" below) every time a new row in the table is used for the report.

The reason I want to do it in VBA rather than using things like this
("[Text51] =Choose([Decision],"Yes","No","Maybe")") is that I know VBA and
although it doesn't look too cryptic, I still want to avoid the hassle of
finding out how to use the syntax/query builder etc
3) Where have you placed the unbound control [Text51]?
In the Detail Section? Yes.

When I type in the following (you suggested using the Value property),
"anything" does not appear on the report but a message box is displayed

with "test" in it for every row in the table meaning the it is called correctly.
Private Sub Report_Page()
MsgBox "test"
Text51.Value = "anything"

So no further ahead.

When you sum it all up, I want to set what appears in the textbox on a
report using VBA at runtime. The Yes, No, Maybe bit is a bit of a red
herring.

Thank you again for this and future help.
Colin
"fredg" <fg******@example.invalid> wrote in message
news:uc****************************@40tude.net...
On 31 Jul 2004 00:03:31 -0700, Colin McGuire wrote:
Thanks for the ways of doing this.

I want to do it like this though.

I want to put an unbound control like a textbox on the report and then
set the "Yes", "No", "Maybe" using VBA. Can this be done?

Here is what I have that isn't working rather than the whole thing.

1. I put a new textbox on the report (called Text51)
2. I have the following in the "Report_Page" event.

Private Sub Report_Page()
Text51.Text="something" 'will be one of Yes,No,Maybe with some VBA
End Sub 'once I get this little bit working.

Text51 doesn't seem to have a Text or Value property and VBA is giving
me an error.

du********@aol.com (Ed Marzan) wrote in message news:<cc**************************@posting.google. com>...> Someone out there is going to give you a nested IIF statement that is
> going to work really nicely. In case they don't try this.
>
> Create a function in a module like this:
>
> Public Function YNM(i As Integer) As String
> 'YesNoMaybe
> Dim strResponse As String
>
> Select Case i
> Case 1
> strResponse = "Yes"
>
> Case 2
> strResponse = "No"
>
> Case 3
> strResponse = "Maybe"
>
> End Select
>
> YNM = strResponse
>
> End Function
>
> Then create a query with a calculated field
>
> DecisionText: YNM([Decision])
>
> The SQL for this would be
>
> SELECT tblMyTable.Decision, YNM([Decision]) AS DecisionText
> FROM tblMyTable;
>
> That ought to do it! Any questions post again.
>
> If you don't like my solution try looking up Nested IIF's in a query
> on Google.
>
> co***********@lycos.co.uk (Colin McGuire) wrote in message news:<ab**************************@posting.google. com>...>> Hi, I have an report in Microsoft Access and it displays everything in>> the table. One column called "DECISION" in the table has either 1,2,
>> or 3 in it. On my report it displays 1, 2, or 3. I want to appear in
>> the report is Yes, No, or Maybe. What do I need to do to change what
>> appears in the report/what term do I need to search out in Google?
>> Thank you
>> Colin


1) If it is a text control (unbound or otherwise) it does have a Value
property.
It's what ever value is returned by the control's control source, i,e,
= "This is it's value.", or a value in a bound field.

2) You're getting your error because you're using the wrong event.
Why are you attempting this in the Page event?

3) Where have you placed the unbound control [Text51]?
In the Detail Section?
Code the Detail Format event:
[Text51] =Choose([Decision],"Yes","No","Maybe")

I don't see any advantage to using code to write the value as opposed
to simply placing the expression directly into the control's control
source, as long as the [Decision] field is a field in the report's
record source.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


Nov 13 '05 #9

P: n/a
Hi Colin,

Isn't the NG great? I really like the nested IIF statement as it seems
very elegant and simple.

=IIf([Decision]=1,"Yes",IIf([Decision]=2,"No","Maybe"))
You state that you wanted the answer written in VBA. I think my corney
little function satisfies that requirement. Post again if you have any
more questions and good luck.

HTH!
"david epsom dot com dot au" <david@epsomdotcomdotau> wrote in message news:<41***********************@news.syd.swiftdsl. com.au>...
You don't (?) normally change the value of a text box in a report.
What you do is Set the Control Source, and the value comes from the
control source. You can only set the control source before the
report is displayed (in the open event normally).

Or you can set the caption on a label.

For what you are doing, using label.caption seems to be appropriate.

For more complex situations, you may wish to set the control source
of a text box to something like "=localfuncTextValue(idxRecord,idxValue)"
Which is more or less equivalent to using a function in the query,
but allows you to use a VBA function that is in the report module,
and lets you put different functions on different controls.

(david)
"Colin McGuire" <co***********@lycos.co.uk> wrote in message
news:10****************@lotis.uk.clara.net...

Thanks for your quick help. Here are more questions because I still can't
get this simple thing going.
2) You're getting your error because you're using the wrong event.
Why are you attempting this in the Page event?


What other event should it be/should I use? (I am not trying to be being
cute, I just don't know) Every row that is printed I want to determine

Yes,
No, or Maybe from a number. This subroutine is called (see my "test"

below)
every time a new row in the table is used for the report.

The reason I want to do it in VBA rather than using things like this
("[Text51] =Choose([Decision],"Yes","No","Maybe")") is that I know VBA and
although it doesn't look too cryptic, I still want to avoid the hassle of
finding out how to use the syntax/query builder etc
3) Where have you placed the unbound control [Text51]?
In the Detail Section?

Yes.

When I type in the following (you suggested using the Value property),
"anything" does not appear on the report but a message box is displayed

with
"test" in it for every row in the table meaning the it is called

correctly.

Private Sub Report_Page()
MsgBox "test"
Text51.Value = "anything"

So no further ahead.

When you sum it all up, I want to set what appears in the textbox on a
report using VBA at runtime. The Yes, No, Maybe bit is a bit of a red
herring.

Thank you again for this and future help.
Colin
"fredg" <fg******@example.invalid> wrote in message
news:uc****************************@40tude.net...
On 31 Jul 2004 00:03:31 -0700, Colin McGuire wrote:

> Thanks for the ways of doing this.
>
> I want to do it like this though.
>
> I want to put an unbound control like a textbox on the report and then
> set the "Yes", "No", "Maybe" using VBA. Can this be done?
>
> Here is what I have that isn't working rather than the whole thing.
>
> 1. I put a new textbox on the report (called Text51)
> 2. I have the following in the "Report_Page" event.
>
> Private Sub Report_Page()
> Text51.Text="something" 'will be one of Yes,No,Maybe with some VBA
> End Sub 'once I get this little bit working.
>
> Text51 doesn't seem to have a Text or Value property and VBA is giving
> me an error.
>
> du********@aol.com (Ed Marzan) wrote in message news:<cc**************************@posting.google. com>... >> Someone out there is going to give you a nested IIF statement that is
>> going to work really nicely. In case they don't try this.
>>
>> Create a function in a module like this:
>>
>> Public Function YNM(i As Integer) As String
>> 'YesNoMaybe
>> Dim strResponse As String
>>
>> Select Case i
>> Case 1
>> strResponse = "Yes"
>>
>> Case 2
>> strResponse = "No"
>>
>> Case 3
>> strResponse = "Maybe"
>>
>> End Select
>>
>> YNM = strResponse
>>
>> End Function
>>
>> Then create a query with a calculated field
>>
>> DecisionText: YNM([Decision])
>>
>> The SQL for this would be
>>
>> SELECT tblMyTable.Decision, YNM([Decision]) AS DecisionText
>> FROM tblMyTable;
>>
>> That ought to do it! Any questions post again.
>>
>> If you don't like my solution try looking up Nested IIF's in a query
>> on Google.
>>
>> co***********@lycos.co.uk (Colin McGuire) wrote in message news:<ab**************************@posting.google. com>... >>> Hi, I have an report in Microsoft Access and it displays everything in >>> the table. One column called "DECISION" in the table has either 1,2,
>>> or 3 in it. On my report it displays 1, 2, or 3. I want to appear in
>>> the report is Yes, No, or Maybe. What do I need to do to change what
>>> appears in the report/what term do I need to search out in Google?
>>> Thank you
>>> Colin

1) If it is a text control (unbound or otherwise) it does have a Value
property.
It's what ever value is returned by the control's control source, i,e,
= "This is it's value.", or a value in a bound field.

2) You're getting your error because you're using the wrong event.
Why are you attempting this in the Page event?

3) Where have you placed the unbound control [Text51]?
In the Detail Section?
Code the Detail Format event:
[Text51] =Choose([Decision],"Yes","No","Maybe")

I don't see any advantage to using code to write the value as opposed
to simply placing the expression directly into the control's control
source, as long as the [Decision] field is a field in the report's
record source.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


Nov 13 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.