Check box in database to text on report

  • Thread starter Thread starter Darhl Thomason
  • Start date Start date
D

Darhl Thomason

I have a check box (true/false) that I want to translate into text on my
report. I tried putting the code into the sub Detail_Format section, but it
errored out with Object Required on the first line of my code. I also put it
into the sub Report_Open but it had the same error. The code I'm using is:

If tblStoreData.NewStore = True Then
txtNewExisting = "New"
Else
txtNewExisting = "Existing"
End If

Any ideas?

Thanks!

d
 
You should not need code to do this.

Just add an unbound text field to your report and put an IFF statement in
it. Something like...

=IIf([NewStore],"New","Existing")
 
Thanks Rick! That was exactly it. I've never used IIF statements before.
I'll have to read up on them so I understand what it's doing.

Thanks again!

d


Rick B said:
You should not need code to do this.

Just add an unbound text field to your report and put an IFF statement in
it. Something like...

=IIf([NewStore],"New","Existing")


--
Rick B



Darhl Thomason said:
I have a check box (true/false) that I want to translate into text on my
report. I tried putting the code into the sub Detail_Format section, but
it errored out with Object Required on the first line of my code. I also
put it into the sub Report_Open but it had the same error. The code I'm
using is:

If tblStoreData.NewStore = True Then
txtNewExisting = "New"
Else
txtNewExisting = "Existing"
End If

Any ideas?

Thanks!

d
 
Darhl said:
I have a check box (true/false) that I want to translate into text on my
report. I tried putting the code into the sub Detail_Format section, but it
errored out with Object Required on the first line of my code. I also put it
into the sub Report_Open but it had the same error. The code I'm using is:

If tblStoreData.NewStore = True Then
txtNewExisting = "New"
Else
txtNewExisting = "Existing"
End If


It looks like tblStoreData is totally extraneous, try
getting rid of it.

OTOH, you can use a custom format for a text box bound to
the yes/no field.

"";"New";"Existing";"Unknown"
 
Back
Top