Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple question

Status
Not open for further replies.

mrathi

Technical User
Oct 27, 2003
115
US
Hello:
I have in a query a comment field. By default it has a value of "*", that is it is not blank. The user may add some comment in some of them. In my report, I want to show the comment only if the user has added comment. How do i do that? I am not very good in VB programming.

Thanks
 
In the field line of the query for the field that holds the comment, erase what you have and put this:

MyComment: =IIF([fieldname]="*","",[fieldname])

and replace fieldname with the name of the field in the table.

****************************
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
ok, now in my query I can see a field MyComment. It shows some blank rows and some with some data. How do I incorporate this into the report? Basically, I am adding this field into my report. However, I want it to be visible only when it has data and not otherwise. Or else, I have empty spaces.

Thanks for your earlier response. I appreciate it.
 
In your report, you include this field. Set the cangrow and canshrink properties to yes and this should "hide" any blanks and make visible anything with a comment.

****************************
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
Thanks again. However, associated with this field is a label and I want to show that label only when the comment is seen. I hope I am not bugging you.

Thanks
 
in the onformat event of the details section of the report, select event procedure and hit the ellipse at the end of the line (the build button). you should be taken to the code window. in this window put:

If Me![fieldname] = "" Then
Me![labelname].Visible = False
Else
Me![labelname].Visible = True
End If

And make sure the canshrink and cangrow properties of the details section are set to yes...

****************************
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top