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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need a field value to equal space

Status
Not open for further replies.

PurpleUnicorn

Programmer
Mar 16, 2001
79
US
I have a form in which the user enters up to 4 lines of text that will later be used in a report. They need the ability to enter spaces as the value for a line. However when I enter spaces and no other text, Access says the field is null and does not store spaces in the table. Is there some way around this?

Thanks

Nancy
 
Hi Nancy!

Change CanShrink property of report textbox false then textbox size will be constant (same design view). Also you can set textbox Control source like following:

Create separate textbox (e.g. txtMyField, but textbox which related to table field make invisible
[=iif(isnull(MyField);Space(NeededSpacesNumber);MyField)

Aivars X-)


 
Thanks for the quick reply. The client does not want the value of the field to always have spaces - sometimes it will be null. I would like the user to be able to enter text, or spaces(with no other text) - if necessary, or leave the field blank. Is there some setting that will cause the spaces that a user types in a field, to be stored in the table?

Nancy
 
Hi Nancy again!

I would be created additional field in the table for selection field report image - null or many spaces. It would be Yes/No (or other type field). In such case user will be selected e.g. True if he wants to print spaces False in opposite. You can try to include into Detail On Format procedure of your report code like following:

private sub detail_onformat()
me.txtMyField.CanShrink = not PrintSpaces
'PrintSpaces - Yes/No field in your table accordingly proposal above
end sub


If it doesn't work (I'm not sure) you can transform Control source (see my previously message) like this:

=iif(PrintSpaces=true;Space(NeededSpacesNumber);MyField)

Aivars :^) - It is 11.30 PM - lying time...
Good night!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top