B
Bayou BoB
Hello!
My form has an option box on it, that is supposed to allow a user to
choose the time duration of a report. As it stands now, they will be
able to print a report for the current month, the current quarter, and
the current year. One button on the form opens a report based on the
option group selection, and then will print a report of all our
clients based on the duration of the report selected via the option
group. The second button is supposed to allow you to print a report on
a single client that is selected from a combo-box, and as well, the
duration of the report selected from the option group. The code that
I'm using for this second instance is below. When I choose the first
button, I am able to select the duration of the report and then get
all of the client's entries printed without too much problem. When I
select a client from the combo box, select a report duration from the
option group, and then press the button, I do get just that client
coming up on the report. However, when I select "Current Month" from
the option group, I still get the whole year for that client, and not
just the current month. Do you see something in the code of the button
below? Many thanks in advance.
Kevin
Private Sub Command33_Click()
On Error GoTo Err_Command33_Click
Dim stDocName As String
Dim stWhere As String
stDocName = "CLI_DetailedAttendance_Rep"
Select Case [Frame0]
Case 1 'Current month
stWhere = "Month([Date]) = " & Month(Date) & "And Year([Date])
= " & Year(Date)
Case 2 'Current quarter
stWhere= (the code I have on current quarter is incorrect and
does not function properly. Perhaps you might suggest some proper code
for this option)
Case 3 'Current year
stWhere = "Year([Date]) = " & Year(Date)
End Select
DoCmd.OpenReport stDocName, acPreview, , "ClientID=" & Me!ClientID,
stWhere
Exit_Command33_Click:
Exit Sub
Err_Command33_Click:
MsgBox Err.Description
Resume Exit_Command33_Click
Many Thanks!!
Kevin
My form has an option box on it, that is supposed to allow a user to
choose the time duration of a report. As it stands now, they will be
able to print a report for the current month, the current quarter, and
the current year. One button on the form opens a report based on the
option group selection, and then will print a report of all our
clients based on the duration of the report selected via the option
group. The second button is supposed to allow you to print a report on
a single client that is selected from a combo-box, and as well, the
duration of the report selected from the option group. The code that
I'm using for this second instance is below. When I choose the first
button, I am able to select the duration of the report and then get
all of the client's entries printed without too much problem. When I
select a client from the combo box, select a report duration from the
option group, and then press the button, I do get just that client
coming up on the report. However, when I select "Current Month" from
the option group, I still get the whole year for that client, and not
just the current month. Do you see something in the code of the button
below? Many thanks in advance.
Kevin
Private Sub Command33_Click()
On Error GoTo Err_Command33_Click
Dim stDocName As String
Dim stWhere As String
stDocName = "CLI_DetailedAttendance_Rep"
Select Case [Frame0]
Case 1 'Current month
stWhere = "Month([Date]) = " & Month(Date) & "And Year([Date])
= " & Year(Date)
Case 2 'Current quarter
stWhere= (the code I have on current quarter is incorrect and
does not function properly. Perhaps you might suggest some proper code
for this option)
Case 3 'Current year
stWhere = "Year([Date]) = " & Year(Date)
End Select
DoCmd.OpenReport stDocName, acPreview, , "ClientID=" & Me!ClientID,
stWhere
Exit_Command33_Click:
Exit Sub
Err_Command33_Click:
MsgBox Err.Description
Resume Exit_Command33_Click
Many Thanks!!
Kevin