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
|
|
0
|
|
|
|
Reply
|
Utf
|
1/7/2008 4:00:00 AM |
|
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
"miss031" <miss031@discussions.microsoft.com> wrote in message
news:C0EE0B28-2B1D-4FC0-960B-053960AA4B0C@microsoft.com...
>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
|
|
0
|
|
|
|
Reply
|
Jeanette
|
1/7/2008 5:44:19 AM
|
|