Changing The Text in a Report Field

nilodor

New member
Local time
Today, 08:15
Joined
Sep 13, 2004
Messages
6
Say I have a text box named text22 whose control source is a check box in a table called MainDB. What I want to do is if the check box is checked display a certain statement, than if the check box is unmarked I want to display different text. How would I go about doing this.

I was thinking something like this:

If (Tables("MainDB").check32 = "yes") Then
Reports("MainDB").Tag.Text22 = "Record is Attached"
End

but I don't know any of the keywords for access, or when the code executes.

*Note this code was typed by selecting text22 and clicking on the code button in the toolbar. If this isn't how I should approach this please let me know.
 
nilodor,

Add a new column to the query:

NewText: IIf([Check32], "Record is attached", "")

Then refer to NewText on your report like any other field
in the query. If that record is checked, you get "Record
is attached", otherwise you get no text.

Wayne
 
Even easier is just use a standard query, put the checkbox on the report and set its visible property to no / false. Then in your control source of the textbox use the same iif statement.

example:

controlsource:=iif([check22]=true,"Statement","Other statement")


Either way will work.
 

Users who are viewing this thread

Back
Top Bottom