strSQL = "UPDATE tblTestRepairOrders SET Closed = True " & _
", DateCompleted = " & Format(Date(), "\#mm\/dd\/yyyy\#")
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Gabby Girl" <(E-Mail Removed)> wrote in message
news

2382F5C-D951-4354-BBFC-(E-Mail Removed)...
> Hello,
>
> The following code works great (a big Thanks to Allen Browne), but now I
> need the date auto filled in the DateCompleted field and I'm having
> trouble
> as to where or what code to use.
> ~~~~~~~~~~~~
> Private Sub cmdCloseROS_Click()
> Dim strSQL As String
>
> If Me.Dirty Then 'Save first.
> Me.Dirty = False
> End If
> strSQL = "UPDATE tblTestRepairOrders SET Closed = True"
> If Me.FilterOn Then
> strSQL = strSQL & " WHERE " & Me.Filter
> End If
> Debug.Print strSQL
> DBEngine(0)(0).Execute strSQL & ";", dbFailOnError
>
> Me.Requery
>
> End Sub
>
> ~~~~~~~
>
> I tried adding: strSQL = "UPDATE tblTestRepairOrders SET DateCompleted =
> Date", but that didn't work (I got Runtime Error 3061. Too few parameters.
> Expected 1). So then I tried adding If Me.chkclosed = -1 Then
> Me.DateCompleted = Date, but that didn't work either ( I got another
> Runtime
> Error. Can't assign a value to this object). Now I'm totally lost.
>
> Can anyone tell me how to amend the above code so it auto adds the date.
>
> Thanks Kindly
>