A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

simple textbox data source syntax question



 
 
Thread Tools Display Modes
  #1  
Old May 25th, 2010, 07:01 PM posted to microsoft.public.access.reports
mark kubicki
external usenet poster
 
Posts: 84
Default simple textbox data source syntax question

Would someone please take a look over my shoulder? I've got the following
code entered as the data source for a text box on a report; but even in it's
simplest state, returns #error#

the intent of the code is to truncate the text at it's first hard return

=mid([CatalogNoMod],1,nz(instr(1,[CatalogNoMod],chr(10)),len([CatalogNoMod])))


any thought would be greatly appreciated in advance
thanks,
mark


  #2  
Old May 25th, 2010, 07:37 PM posted to microsoft.public.access.reports
John Spencer
external usenet poster
 
Posts: 7,815
Default simple textbox data source syntax question

Try the following

=Mid([CatalogNoMod],1,Instr(1,[CatalogNoMod] & Chr(10),Chr(10))-1)

I might be looking for Chr(13) instead of Chr(10) since Access usually stores
Chr(13) & Chr(10) [in that order] to generate a new line.

Also make sure that the name of the textbox control is NOT CatalogNoMod. That
will cause an error

By the way
instr(1,[CatalogNoMod],chr(10))
Is NOT going to return null if Chr(10) is not in the string. It is going to
return zero. It will return NULL if CatalogNoMod is Null


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

Mark Kubicki wrote:
Would someone please take a look over my shoulder? I've got the following
code entered as the data source for a text box on a report; but even in it's
simplest state, returns #error#

the intent of the code is to truncate the text at it's first hard return

=mid([CatalogNoMod],1,nz(instr(1,[CatalogNoMod],chr(10)),len([CatalogNoMod])))


any thought would be greatly appreciated in advance
thanks,
mark


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:00 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.