Can anyone tell me why the example1 on my forms after update event gives me the following error message "number of query values and destination fields not the same?"
Yet the 2nd example works and injects without a hitch into the table "attend".
All I have changed is to added another field to the list so as I can "catch/pickup/record" the logged on user that has updated/amended or appended a record via a form, does seem to be to difficult I would have thought!, but I am pulling my hair out on this one
Example1...
Code:
RecDetect = DLookup("[scrStudent]", "attend", "[attstudent] = " & Me![scrStudent] & " AND [Attdate] = #" & Format(TDate, "mm/dd/yy") & "#")
If IsNull(RecDetect) Then
strSql = "INSERT INTO Attend ( AttStudent, AttDate, LogOnUser ) " _
& "SELECT " & Me![scrStudent] & " AS F1, #" & Format(TDate, "mm/dd/yy") & "# AS F2, " & TypeAttend & " AS F3, #" & Me![txtUserId] & " AS F4;"
DoCmd.RunSQL strSql
else...do something else
Example2...
Code:
RecDetect = DLookup("[scrStudent]", "attend", "[attstudent] = " & Me![scrStudent] & " AND [Attdate] = #" & Format(TDate, "mm/dd/yy") & "#")
If IsNull(RecDetect) Then
strSql = "INSERT INTO Attend ( AttStudent, AttDate, AttType ) " _
& "SELECT " & Me![scrStudent] & " AS F1, #" & Format(TDate, "mm/dd/yy") & "# AS F2, " & TypeAttend & " AS F3;"
DoCmd.RunSQL strSql
else...do something else
What I am I doing wrong, as I have no clue how remedy this one!
and have been staring at this for hours now(I have attached the example)
Many thanks in advance for any pointers towards a fix...