dcount problem

G

Guest

I have a form that I would like to have it tell the user how many overdue
diaries they have. By user I also mean the person's supervisor. On the form
there are 3 means of filtering the information, by Client (cboClientSort), by
User (cboUserSort), by Category (cboCategorySort). What I would like to do
is place the following inside the After Update of the cbo so as to tell how
many overdue items of each there are. I originally had this in the form load
and it worked but now the form is being redone and it doesn't have a
recordsource until the cbo is selected. I am having a tough time getting to
place the cbo in the proper way so it is looked at as well as the
FollowUpDate.

Dim intStore As Integer
intStore = DCount("[ImplementationDiaryListID]",
"[usrtblImplementationDiaryList]", "[FollowUpDate]<=Now()")
If intStore = 0 Then
Exit Sub
Else
If MsgBox("There are " & "[ " & intStore & " ]" & " followup
date(s) " & _
"overdue.", vbOKOnly, "Overdue FollowUp Dates") Then
Else
Exit Sub
End If
End If

I ask assistance in placing the cbo correctly. Thanks to anyone assisting.
*** John
 
B

Brian

JohnE said:
I have a form that I would like to have it tell the user how many overdue
diaries they have. By user I also mean the person's supervisor. On the form
there are 3 means of filtering the information, by Client (cboClientSort), by
User (cboUserSort), by Category (cboCategorySort). What I would like to do
is place the following inside the After Update of the cbo so as to tell how
many overdue items of each there are. I originally had this in the form load
and it worked but now the form is being redone and it doesn't have a
recordsource until the cbo is selected. I am having a tough time getting to
place the cbo in the proper way so it is looked at as well as the
FollowUpDate.

Dim intStore As Integer
intStore = DCount("[ImplementationDiaryListID]",
"[usrtblImplementationDiaryList]", "[FollowUpDate]<=Now()")
If intStore = 0 Then
Exit Sub
Else
If MsgBox("There are " & "[ " & intStore & " ]" & " followup
date(s) " & _
"overdue.", vbOKOnly, "Overdue FollowUp Dates") Then
Else
Exit Sub
End If
End If

I ask assistance in placing the cbo correctly. Thanks to anyone assisting.
*** John

Try putting it in the form's Current event?
 
G

Guest

Brian, thanks for the response. It works the same as when I had it in the
form load. I'm looking to have it work when cboUserNameSort is selected. My
problem is putting the cbo into the dcount function. If I take what is below
and place it into the After_Update of the cbo, it will work, but it says the
total number in the table that are overdue. This will give the user and
their superv a false reading. Only need it to show how many for the selected
user in the cbo. Any further thoughts and assistance is welcomed.
*** John

Brian said:
JohnE said:
I have a form that I would like to have it tell the user how many overdue
diaries they have. By user I also mean the person's supervisor. On the form
there are 3 means of filtering the information, by Client (cboClientSort), by
User (cboUserSort), by Category (cboCategorySort). What I would like to do
is place the following inside the After Update of the cbo so as to tell how
many overdue items of each there are. I originally had this in the form load
and it worked but now the form is being redone and it doesn't have a
recordsource until the cbo is selected. I am having a tough time getting to
place the cbo in the proper way so it is looked at as well as the
FollowUpDate.

Dim intStore As Integer
intStore = DCount("[ImplementationDiaryListID]",
"[usrtblImplementationDiaryList]", "[FollowUpDate]<=Now()")
If intStore = 0 Then
Exit Sub
Else
If MsgBox("There are " & "[ " & intStore & " ]" & " followup
date(s) " & _
"overdue.", vbOKOnly, "Overdue FollowUp Dates") Then
Else
Exit Sub
End If
End If

I ask assistance in placing the cbo correctly. Thanks to anyone assisting.
*** John

Try putting it in the form's Current event?
 
B

Brian

JohnE said:
Brian, thanks for the response. It works the same as when I had it in the
form load. I'm looking to have it work when cboUserNameSort is selected. My
problem is putting the cbo into the dcount function. If I take what is below
and place it into the After_Update of the cbo, it will work, but it says the
total number in the table that are overdue. This will give the user and
their superv a false reading. Only need it to show how many for the selected
user in the cbo. Any further thoughts and assistance is welcomed.
*** John

Brian said:
JohnE said:
I have a form that I would like to have it tell the user how many overdue
diaries they have. By user I also mean the person's supervisor. On
the
form
there are 3 means of filtering the information, by Client
(cboClientSort),
by
User (cboUserSort), by Category (cboCategorySort). What I would like
to
do
is place the following inside the After Update of the cbo so as to
tell
how
many overdue items of each there are. I originally had this in the
form
load
and it worked but now the form is being redone and it doesn't have a
recordsource until the cbo is selected. I am having a tough time
getting
to
place the cbo in the proper way so it is looked at as well as the
FollowUpDate.

Dim intStore As Integer
intStore = DCount("[ImplementationDiaryListID]",
"[usrtblImplementationDiaryList]", "[FollowUpDate]<=Now()")
If intStore = 0 Then
Exit Sub
Else
If MsgBox("There are " & "[ " & intStore & " ]" & " followup
date(s) " & _
"overdue.", vbOKOnly, "Overdue FollowUp Dates") Then
Else
Exit Sub
End If
End If

I ask assistance in placing the cbo correctly. Thanks to anyone assisting.
*** John

Try putting it in the form's Current event?

intStore =
DCount("[ImplementationDiaryListID]","[usrtblImplementationDiaryList]",
"[FollowUpDate]<=Now() AND User = """ & cboUserSort & """")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top