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.
 

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

Similar Threads


Back
Top