Hello,
I am looking for some guidance on the following sql statement which I am using as a record source of a form.
I am not sure if I can use the DLookup in this way. Some of the issue is the comma after the Dlookup. when I have the comma is indicating error "3141 the SELECT statement incudes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect
When I remove the comma does not show any error but the field that I am trying to lookup shows #Error.
any help will be greatly appretiated
I am looking for some guidance on the following sql statement which I am using as a record source of a form.
I am not sure if I can use the DLookup in this way. Some of the issue is the comma after the Dlookup. when I have the comma is indicating error "3141 the SELECT statement incudes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect
When I remove the comma does not show any error but the field that I am trying to lookup shows #Error.
any help will be greatly appretiated
Code:
SQL = "SELECT tblTaskAssignment.taskAssignmentID, tblTaskDefinition.TaskDescription, tblTaskAssignment.TaskAssignmentStatusUpdated, tbluser.username, tbluser.userid, tbluser.UserTypeID, tblTaskAssignment.TaskAssignmentStatus, tblTaskStatus.TaskStatus, tblTaskAssignment.TaskAssignedtoID, tblTaskAssignment.TaskAssignedBackupID, tblTaskAssignment.TaskApproverID, tblTaskAssignment.TaskAssignmentStartDate, tblTaskAssignment.TaskAssignmentEndDate, tblTaskAssignment.TaskFirstDueDate, tblTaskAssignment.TaskAssignedtoID, tblTaskAssignment.TaskAssignedBackupID, tblTaskAssignment.TaskApproverID, " _
& "DLookUp([username],""tbluser"","" userID ="" & tblTaskAssignment.TaskAssignedBackupID) AS ApproverBackup," _
& " FROM ((tblTaskAssignment INNER JOIN tblTaskDefinition ON tblTaskAssignment.TaskID = tblTaskDefinition.taskID) INNER JOIN tbluser ON tblTaskAssignment.TaskAssignedtoID = tbluser.userid) INNER JOIN tblTaskStatus ON tblTaskAssignment.TaskAssignmentStatusUpdated = tblTaskStatus.TaskStatusID " _
& " WHERE (((tblTaskAssignment.TaskAssignmentStatusUpdated)=2))" _
& " ORDER BY tblTaskDefinition.TaskDescription;"