I have a query (QryPresident_Count) which returns two fields - TxtUnit and CountOfTotal. If the CountOfTotal is greater than 2 I need to run another query (QryPresident_DeleteDuplicates(W)) to remove the unwanted records from the underlying table.
I have written the code below but when I run it I receive a message "Type Mismatch".
Can anyone tell me if what I am trying to do is possible and point out where I am going wrong
Best Regards
John
I have written the code below but when I run it I receive a message "Type Mismatch".
Code:
stDocName = "QryPresident_Count"
DoCmd.OpenQuery stDocName, acNormal, acEdit
If "CountOfTotal" > 2 Then
DoCmd.OpenQuery "QryPresident_DeleteDuplicates(W)", , acEdit
DoCmd.OpenReport "RptPresident", acPreview
DoCmd.RunCommand acCmdZoom100
Else
DoCmd.OpenTable "TblPresident2"
End If
Can anyone tell me if what I am trying to do is possible and point out where I am going wrong
Best Regards
John