combo notinlist for date

M

miss031

I have a lookup table for dates, consisting of just the primary key (date_ID)
and the date (date_). I look up and select dates from combos whose source is
this table, but I cannot figure out the syntax for a notinlist code to add
dates to the combos. Here is the notinlist code that I use with all my other
text combos:

______________________________________

Dim sqlAddmake As String, Response As Integer

DoCmd.SetWarnings False

If IsNull(Me.Text2) = False Then
sqlAddmake = "Insert Into tbl_lkp_dates ([date_]) values (#" &
Me.Text2 & "#)"
CurrentDb.Execute sqlAddmake
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If

DoCmd.SetWarnings True
 
J

Jeanette Cunningham

Hi,
try changing the sql string to this:

sqlAddmake = "Insert Into tbl_lkp_dates ([date_]) values ( #" & Format(
Me.Text2, "mm\/dd\/yyyy") & "# ) "

Have a look at www.allenbrowne.com
Find the section on dates and read about formatting dates in month /day
/year format for the Jet engine.

Jeanette Cunningham
 

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