How can I tie the users shortname to this code. so it comes back with the results that only apply to them.
Dim pastdue As Integer
Dim current As Integer
Dim tot As Integer
nodate = DCount("*", "TARA", "isNull(penddte )")
pastdue = DCount("*", "TARA", "penddte < date()")
current = DCount("*", "TARA", "penddte >= date()")
tot = DCount("*", "TARA")
Debug.Print nodate, pastdue, current, tot
Me.message = "You have " & tot & " items with " & pastdue & " past due, " & current & " current and " & nodate & " with no pending date"
End Sub
Right now it totals the entire database. I have a text box called txtusername that captures the users shortname when they login (using a function) that same shortname is in the maintable and that field is called Login id.
So what I would want to say is: count the number of items where the "penddte"(anoth er field in the maintable) isnull and the txtusername is = to the field called loginid. I don't think I have my syntax correct. i get an cancell operation error.
nodate = DCount("*", "TARA", "isNull(penddte )" & " and [loginID]= " & Me.txtUserName)
Dim pastdue As Integer
Dim current As Integer
Dim tot As Integer
nodate = DCount("*", "TARA", "isNull(penddte )")
pastdue = DCount("*", "TARA", "penddte < date()")
current = DCount("*", "TARA", "penddte >= date()")
tot = DCount("*", "TARA")
Debug.Print nodate, pastdue, current, tot
Me.message = "You have " & tot & " items with " & pastdue & " past due, " & current & " current and " & nodate & " with no pending date"
End Sub
Right now it totals the entire database. I have a text box called txtusername that captures the users shortname when they login (using a function) that same shortname is in the maintable and that field is called Login id.
So what I would want to say is: count the number of items where the "penddte"(anoth er field in the maintable) isnull and the txtusername is = to the field called loginid. I don't think I have my syntax correct. i get an cancell operation error.
nodate = DCount("*", "TARA", "isNull(penddte )" & " and [loginID]= " & Me.txtUserName)
Comment