Assigning a control source

G

Guest

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?
 
G

Guest

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.
 

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

Top