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!

Linefeed

Status
Not open for further replies.

johnbward1939

Technical User
Nov 18, 2010
9
GB
I am using Microsoft access 2007
When I use the following codes in the Control Source of the Property Sheet I get #Name? error on the form
vbCrLf,………vbCr,………vbLf,………VbNewLine, and Chr(13),………Chr(10),………Chr(13)+Chr(10),………Chr(13) & (10),………with and without the $ sign
The Chr$(13) & Chr$(10) use to work until I upgraded from MS Access 2003. Can you help please
 
You can't use vba constants in control sources (vbCrLf...). You should be able to use:
Chr(13) & Chr(10)
If this doesn't work, look for other issues such as the name of the text box being the same as the name of a field.


Duane
Hook'D on Access
MS Access MVP
 
Thanks for your reply. Just tried that and with a new text box and a unique name, still the same error message
 
Yes. All the fields are in the form record source. If I omit the Chr(13) and Chr(10) it all works but all on one line.
The code I have is
=[Starter] & Chr(13)& Chr(10) & [Fish Course] & Chr(13)& Chr(10) & [Main Course] & Chr(13)& Chr(10) & IIf([Vegetable1]>"",[Vegetable1]) & Chr(13)&Chr(10) & [Vegetable2] & Chr(13)& Chr(10) & [Vegetable3] & " " & [Vegetable4] & Chr(13)&Chr(10) & [Desert] & Chr(13)& Chr(10) & [Cheese] & Chr(13)&Chr(10) & [Coffee]
 
johnbward1939:

You gotta be sure to put the spaces between the ampersands:

It should be:

=[Starter] & Chr(13) & Chr(10) & [Fish Course] & Chr(13) & Chr(10) & [Main Course] & Chr(13) & Chr(10) & IIf([Vegetable1]>"",[Vegetable1]) & Chr(13) & Chr(10) & [Vegetable2] & Chr(13) & Chr(10) & [Vegetable3] & " " & [Vegetable4] & Chr(13) & Chr(10) & [Desert] & Chr(13) & Chr(10) & [Cheese] & Chr(13) & Chr(10) & [Coffee]

It isn't like VBA which will put the spaces in for you.

Bob Larson
Free Access Tutorials and Samples:
 
Yes running in trusted mode. Yes I've tried it with just one set of Chr(13) & Chr(10).
 
Sorry don't understand. What modified expression you fixed for me????
 
Sorry don't understand. What modified expression you fixed for me????

This one (your post had spaces missing for many of the ampersands (&):
=[Starter] & Chr(13) & Chr(10) & [Fish Course] & Chr(13) & Chr(10) & [Main Course] & Chr(13) & Chr(10) & IIf([Vegetable1]>"",[Vegetable1]) & Chr(13) & Chr(10) & [Vegetable2] & Chr(13) & Chr(10) & [Vegetable3] & " " & [Vegetable4] & Chr(13) & Chr(10) & [Desert] & Chr(13) & Chr(10) & [Cheese] & Chr(13) & Chr(10) & [Coffee]

Bob Larson
Free Access Tutorials and Samples:
 
I had tried =[Starter] & Chr(13) & Chr(10) & [Fish Course] & Chr(13) & Chr(10) & [Main Course] & Chr(13) & Chr(10) & IIf([Vegetable1]>"",[Vegetable1]) & Chr(13) & Chr(10) & [Vegetable2] & Chr(13) & Chr(10) & [Vegetable3] & " " & [Vegetable4] & Chr(13) & Chr(10) & [Desert] & Chr(13) & Chr(10) & [Cheese] & Chr(13) & Chr(10) & [Coffee]

Still not working
it was sloopy typing it's 11pm here
 
I don't know if it works the same way with FORMS but with Reports you have to make sure that your controls do not have the same name as any of the fields when you do a formula in the control source.



Bob Larson
Free Access Tutorials and Samples:
 
I have tried the code in a new database and it works. But still not working in the updated database. Do I have to re write the whole of old database or only the reports?
 
Thank for you help
I think I found the problem. I tried importing fields to new database and got this error "Attachment fields are not supported in the MDB or ADP database formats. If attachment fields are included in the source database tables, those fields will not be imported." Looks like a rewrite as I want to package and distribute. I don't want to link to the old database.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top