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!

Is field needed on report in order to reference it?

Status
Not open for further replies.

lorirobn

MIS
Mar 15, 2005
450
US
Hi,

I have a report that has a query as its record source.

Several of my table fields are stored in codes that I am translating at run time. I've got this VBA code working fine. But something is driving me crazy. I have to have the Code field as a field on my report, in addition to the text field with my translation, even though I am not displaying the Code field on my report. Otherwise, the VBA code where I reference the Code does not work. So I have to include it, and I make it not visible.

I hate to clutter up my report in design view with these invisible fields.

Is it correct that in order to reference a field in VBA, you need to have it on the report itself? It's in my query - can I reference the field in the Query somehow?

My code is:
Code:
If RoomName = "GR" Then
   txtRoomName = "Guest Room"
ElseIf RoomName = "F" Then
   txtRoomName = "Faculty"
End If
I would like to delete the text box 'roomname' from my report.

Thanks in advance!
 
Yes, in order to reference a value on your report, the field will need to be on your report. If you want to cut down on the clutter in your report design view, you can shrink the size of that "invisible" field down to nearly nothing.
 
Thank you.
I have already shrunk the 4-5 fields that I'm doing this for, so I guess I've done it as best as I can do. It's a continuous form with only 1 line (space is at a premium)... so it gets confusing when I want to move fields around.

but oh well, at least I know I am doing it right.
thanks again,
Lori
 
Instead of shrinking the field, you can also make it invisible. Like make the text white and put it behind another field, stuff like that.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top