As a relative beginner I'm having problems with a SQL delete script. I created a query and then viewed it in SQL view copied it and then used it in my code.
The coded version is
Basically I need to delete a row from the table TblProjectStats where InUseBy = GlbUserID. The table contains 4 fields.
Problem is I have had all sorts of errors some mentioning I have too many or too few ( and the final error was a type mismatch. All fields in TblProjectStats are Text fields apart from LID which is a Date. GlbUserID is Text and is a global field derived a startup using Environ("username") to find out who is logged on.
Grateful for any help
Thanks
Mych
The coded version is
Code:
DoCmd.SetWarnings False
strSQL = "DELETE TblProjectStats.ProjectID, TblProjectStats.ProjectName, "
strSQL = strSQL & "TblProjectStats.LID, TblProjectStats.InUseBy "
strSQL = strSQL & "FROM TblProjectStats "
strSQL = strSQL & "WHERE (TblProjectStats.InUseBy = " & GlbUserID & ");"
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
Basically I need to delete a row from the table TblProjectStats where InUseBy = GlbUserID. The table contains 4 fields.
Problem is I have had all sorts of errors some mentioning I have too many or too few ( and the final error was a type mismatch. All fields in TblProjectStats are Text fields apart from LID which is a Date. GlbUserID is Text and is a global field derived a startup using Environ("username") to find out who is logged on.
Grateful for any help
Thanks
Mych