syntax question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!!
 
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'"
 
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 & "'" &
_
 
Back
Top