ControlSource using VBA

  • Thread starter Thread starter geebee
  • Start date Start date
G

geebee

Hi,

I have the following on an Onclick:

Me!calculated_allocation2.ControlSource = DSum
("[vouchamt]", "fy02_basetable", "program=[obligation2]
AND fy =[forms]![password]![fy]")


Howver, I am getting an "#Name?" message in the
[calculated_allocation2] field.

Does anyone know why?


Thanks in advance,
geebee
 
The assigned value for control source needs to be enclosed in double quotes and
any double quotes in the control source need to be changed to single quotes.
Like this:

Me!calculated_allocation2.ControlSource = " = DSum('[vouchamt]', _
'fy02_basetable', 'program=[obligation2] _
AND fy =[forms]![password]![fy]')"

You can copy and paste this as is into your code.
 
Back
Top