syntax question

S

smk23

Greetings and Happy Holidays!

I would like to programmatically change the ControlSource as follows:

Me.NameDisplay.ControlSource = "= ' Fun Data' " & vbCrLf & _

but I get an error when I add anything beyond my last "
What's the correct syntax?
Thanks for the help!!
 
F

fredg

Greetings and Happy Holidays!

I would like to programmatically change the ControlSource as follows:

Me.NameDisplay.ControlSource = "= ' Fun Data' " & vbCrLf & _

but I get an error when I add anything beyond my last "
What's the correct syntax?
Thanks for the help!!

VbCrLf is a VBA constant, so while you can use it in VBA you cannot
use it in a control's record source expression. You must use chr(13) &
chr(10).

Try it this way:
Me!NameDisplay.ControlSource = "= ' Fun Data' & Chr(13) & Chr(10) & '
Hello'"
 
M

Marshall Barton

smk23 said:
I would like to programmatically change the ControlSource as follows:

Me.NameDisplay.ControlSource = "= ' Fun Data' " & vbCrLf & _

but I get an error when I add anything beyond my last "


Try this:

Me.NameDisplay.ControlSource = "='Fun Data" & vbCrLf & "'" &
_
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top