Adding data to reports in Access 2k

  • Thread starter Thread starter Stephen Harrington
  • Start date Start date
S

Stephen Harrington

Hi--

What I'm trying to do is something very simple. I am trying to append
text to a report in Access only when there is data listed. Let me 'splain.

This database is used for tracking computer inventory. One particular
field is just a text field on a report which is the size of the hard
drives. So, there's a heading which is basically a label that says
"Hard Drives". However, the fields that are filled in on the report are
just the raw numbers, or, the sizes of the hard drives.

What I want to happen is that if there is data in the field HardDrive, I
want to have the abbreviation "GB" appended to the end automatically.
If you need clarification, reply directly to me and post here.

Thanks in advance!
Stephen Harrington
 
Stephen said:
Hi--

What I'm trying to do is something very simple. I am trying to append
text to a report in Access only when there is data listed. Let me 'splain.

This database is used for tracking computer inventory. One particular
field is just a text field on a report which is the size of the hard
drives. So, there's a heading which is basically a label that says
"Hard Drives". However, the fields that are filled in on the report are
just the raw numbers, or, the sizes of the hard drives.

What I want to happen is that if there is data in the field HardDrive, I
want to have the abbreviation "GB" appended to the end automatically.
If you need clarification, reply directly to me and post here.

Set the text box's Format property to something like:

0.0#"GB";;""
 
Stephen,
I take it HardDrive is a numeric field. I'm checking for null, but you
may have 0 or empty instead. Change code to suit your situation.
An unbound text control (ex. called [txtHardDrive]) with a Control Source
of...

= IF(IsNull([HardDrive],"",[HardDrive] & " GB")

should do it.

hth
Al Camp
 
Marshall said:
Stephen Harrington wrote:




Set the text box's Format property to something like:

0.0#"GB";;""

Okay, tried that and still no change. Let me just make sure I am adding
it in the proper location. I am in the properties of the text box which
displays the data based on the query. I insert that code into the
properties of that into the Format box. I inserted it into that box AS
IS. Any other ideas?

Thanks again!
 
Stephen,
I like Marshall's solution much better than the one I suggested. His
answer allows you to edit the field directly... mine doesn't.
But...
I set a numeric field Format to what Marshall indicated, and it worked
just fine. So something is amiss.

What was the value stored in the table, and how did it display... before
and after... no difference??
hth
Al Camp
 
Neither of these worked. I tried both solutions and neither formatted
the data with the additional data. I have entered both into the Format
property both in the table design view, and also into the report design
view. Any other ideas? I'll keep dorking with it and see if something
changes.

Thanks
 
Nevermind guys, I figured it out. I forgot that I needed to change the
field type to numeric. As soon as I did that, it worked like a charm!
Thanks a ton!

Stephen
 
Back
Top