Assigning a control source

S

SHIPP

I am using the following to assign a control source to a text box on a form.

Me.dteDay3.ControlSource = "=DateAdd(" & "d" & ", 8,
[Forms]![frmPromoCurrent].[StartDate])"

When it executes to code it puts ?Name in the text box. However, if I simply
place the code in the control source of the text box (without the ") then it
works fine. Of course I have to leave the " around the d. Any answers?
 
S

SHIPP

I found out what I was doing wrong. The code should be:

Me.dteDay3.ControlSource = "=DateAdd(" & Chr(34) & "d" & Chr(34) & ", 8,
[Forms]![frmPromoCurrent].[StartDate])"

This works like it's supposed to.
 
Top