setting controlsource

  • Thread starter Thread starter Brian
  • Start date Start date
B

Brian

Hello all.

This is what I want to do in vba code on form load.

Me.txtBanner.ControlSource = DLookup
("Version", "Version", "[Stop] = Yes")

The problem is that I need an equals sign before dlookup
or I get #Name in the text box.

can't put the dlookup error in quotes like this
"=DLookup("Version", "Version", "[Stop] = Yes")"

I get a compile error...end of statement.

any suggestions on how I do this?
 
In your expression:
"=DLookup("Version", "Version", "[Stop] = Yes")"
Access thinks it has come to the end of the quote just before Version, and
doesn't know what to do with the rest of the line. Where you have quotes in
quotes, you must double them up, e.g.:
"This string has a ""word"" in quotes"

Try:
Me.txtBanner.ControlSource = "=DLookup(""Version"", ""Version"", ""[Stop] =
True"")"
 
Back
Top