|
Hi there - can anyone help with my syntax - when a user presses the submit command button i want the date that they have entered into an unbound drop down date field called 'dls' to be inserted into a field called 'datelastsubmitted' into 'tblusers' and it should enter it against the appropriate user who is logged in (this logged in users are stored in a global variable called 'loginname').
Her is my syntax:
Private Sub submit_Click() Dim sql As String dls = Me!dls Dim rsdbase As Database Dim rstemp As Recordset Set rsdbase = CurrentDb Set rstemp = rsdbase.OpenRecordset("INSERT INTO tblusers[datelastsubmitted] VALUES dls WHERE tblusers[loginname] = '" & loginname & "'") DoCmd.RunSQL sql End Sub
VBA doesnt like the line set rstemp to loginname & "'") - can anyone point out where i have gone wrong.
Thanks,
Rhys. |