Sorting by name and date in a report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If someone can help me that would be awesome!

I have a downloaded MDB from microsoft that has been tweeked, well VERY
modified (contact management database) I have added a combo box named "sales
associates" and created a table, also created a relationship for that table
to the data that I want that table to refer to. I have also created a report
named "sales associate".

What I would like to do is create a button (or use the existing "view
reports" button) that will allow me to choose the sales associate (ie Billy,
Joe, Jim or Bob etc.) pick a to and from date, and print a report for that
person for the designated time frame.

I hope this is not asking too much, but you guys are awesome here and there
is always an answer. Thanks in advance
 
Create a form to accept the sales associate, and the date range. Include a
command button to print the report. Whether you use the existing button or
add a new one to your current report is not important. It just needs to open
this new form. I suggest a Combo for the Sales Associate and text boxes for
the dates.

Then in the Click event of the Print button, use the values entered in the
control to pass a Where argument to the OpenReport method, then close the
form:

Dim strWhere As String

strWhere = "[ASSOCIATE_ID] = '" & Me.cboAssociate & _
"' AND [SomeDate] BETWEEN #" & Me.txtFromDate & "# AND #" _
Me.txtToDate & "#"
DoCmd.OpenReport "rptSalesAssociates", acViewNormal, , strWhere
DoCmd.Close
 
Thank you Klatuu for your reply to my post.

I am still having problems getting this thing to work.

I created a new form as instructed and named it "Associate", within the form
I created one combo box and named it "cboAssociate" and linked that to the
table with the Associate names in it. I also created two text boxes and
named them "FromDate" and "ToDate" with a command button named "cmdAssociate"

I tried to use the code in VB that was supplied but got a load of errors.

Note: I am not as savy as the pros in here, please bare with me =0P

Klatuu said:
Create a form to accept the sales associate, and the date range. Include a
command button to print the report. Whether you use the existing button or
add a new one to your current report is not important. It just needs to open
this new form. I suggest a Combo for the Sales Associate and text boxes for
the dates.

Then in the Click event of the Print button, use the values entered in the
control to pass a Where argument to the OpenReport method, then close the
form:

Dim strWhere As String

strWhere = "[ASSOCIATE_ID] = '" & Me.cboAssociate & _
"' AND [SomeDate] BETWEEN #" & Me.txtFromDate & "# AND #" _
Me.txtToDate & "#"
DoCmd.OpenReport "rptSalesAssociates", acViewNormal, , strWhere
DoCmd.Close



Paul M said:
If someone can help me that would be awesome!

I have a downloaded MDB from microsoft that has been tweeked, well VERY
modified (contact management database) I have added a combo box named "sales
associates" and created a table, also created a relationship for that table
to the data that I want that table to refer to. I have also created a report
named "sales associate".

What I would like to do is create a button (or use the existing "view
reports" button) that will allow me to choose the sales associate (ie Billy,
Joe, Jim or Bob etc.) pick a to and from date, and print a report for that
person for the designated time frame.

I hope this is not asking too much, but you guys are awesome here and there
is always an answer. Thanks in advance
 
Okay, post the code as you have it now. Also, let me know which event in
which form it is, what errors you are getting in the code, and what line the
error is happening on.

Paul M said:
Thank you Klatuu for your reply to my post.

I am still having problems getting this thing to work.

I created a new form as instructed and named it "Associate", within the form
I created one combo box and named it "cboAssociate" and linked that to the
table with the Associate names in it. I also created two text boxes and
named them "FromDate" and "ToDate" with a command button named "cmdAssociate"

I tried to use the code in VB that was supplied but got a load of errors.

Note: I am not as savy as the pros in here, please bare with me =0P

Klatuu said:
Create a form to accept the sales associate, and the date range. Include a
command button to print the report. Whether you use the existing button or
add a new one to your current report is not important. It just needs to open
this new form. I suggest a Combo for the Sales Associate and text boxes for
the dates.

Then in the Click event of the Print button, use the values entered in the
control to pass a Where argument to the OpenReport method, then close the
form:

Dim strWhere As String

strWhere = "[ASSOCIATE_ID] = '" & Me.cboAssociate & _
"' AND [SomeDate] BETWEEN #" & Me.txtFromDate & "# AND #" _
Me.txtToDate & "#"
DoCmd.OpenReport "rptSalesAssociates", acViewNormal, , strWhere
DoCmd.Close



Paul M said:
If someone can help me that would be awesome!

I have a downloaded MDB from microsoft that has been tweeked, well VERY
modified (contact management database) I have added a combo box named "sales
associates" and created a table, also created a relationship for that table
to the data that I want that table to refer to. I have also created a report
named "sales associate".

What I would like to do is create a button (or use the existing "view
reports" button) that will allow me to choose the sales associate (ie Billy,
Joe, Jim or Bob etc.) pick a to and from date, and print a report for that
person for the designated time frame.

I hope this is not asking too much, but you guys are awesome here and there
is always an answer. Thanks in advance
 
the code I am using is....

Private Sub cmdAssociate_Click()
Dim strWhere As String
strWhere = "[ASSOCIATE_ID] = '" & Me.cboAssociate & _
"' AND [SomeDate] BETWEEN #" & Me.FromDate & "# AND #" _
Me.ToDate & "#"
DoCmd.OpenReport "rptSalesAssociates", acViewNormal, , strWhere
DoCmd.Close

End Sub

the error I am getting is....

Compile Error:
Expected end of statement

Klatuu said:
Okay, post the code as you have it now. Also, let me know which event in
which form it is, what errors you are getting in the code, and what line the
error is happening on.

Paul M said:
Thank you Klatuu for your reply to my post.

I am still having problems getting this thing to work.

I created a new form as instructed and named it "Associate", within the form
I created one combo box and named it "cboAssociate" and linked that to the
table with the Associate names in it. I also created two text boxes and
named them "FromDate" and "ToDate" with a command button named "cmdAssociate"

I tried to use the code in VB that was supplied but got a load of errors.

Note: I am not as savy as the pros in here, please bare with me =0P

Klatuu said:
Create a form to accept the sales associate, and the date range. Include a
command button to print the report. Whether you use the existing button or
add a new one to your current report is not important. It just needs to open
this new form. I suggest a Combo for the Sales Associate and text boxes for
the dates.

Then in the Click event of the Print button, use the values entered in the
control to pass a Where argument to the OpenReport method, then close the
form:

Dim strWhere As String

strWhere = "[ASSOCIATE_ID] = '" & Me.cboAssociate & _
"' AND [SomeDate] BETWEEN #" & Me.txtFromDate & "# AND #" _
Me.txtToDate & "#"
DoCmd.OpenReport "rptSalesAssociates", acViewNormal, , strWhere
DoCmd.Close



:

If someone can help me that would be awesome!

I have a downloaded MDB from microsoft that has been tweeked, well VERY
modified (contact management database) I have added a combo box named "sales
associates" and created a table, also created a relationship for that table
to the data that I want that table to refer to. I have also created a report
named "sales associate".

What I would like to do is create a button (or use the existing "view
reports" button) that will allow me to choose the sales associate (ie Billy,
Joe, Jim or Bob etc.) pick a to and from date, and print a report for that
person for the designated time frame.

I hope this is not asking too much, but you guys are awesome here and there
is always an answer. Thanks in advance
 
You are missing a concatenation symbol on this line.
"' AND [SomeDate] BETWEEN #" & Me.FromDate & "# AND #" _
It should be
"' AND [SomeDate] BETWEEN #" & Me.FromDate & "# AND #" & _


Paul M said:
the code I am using is....

Private Sub cmdAssociate_Click()
Dim strWhere As String
strWhere = "[ASSOCIATE_ID] = '" & Me.cboAssociate & _
"' AND [SomeDate] BETWEEN #" & Me.FromDate & "# AND #" _
Me.ToDate & "#"
DoCmd.OpenReport "rptSalesAssociates", acViewNormal, , strWhere
DoCmd.Close

End Sub

the error I am getting is....

Compile Error:
Expected end of statement

Klatuu said:
Okay, post the code as you have it now. Also, let me know which event in
which form it is, what errors you are getting in the code, and what line the
error is happening on.

Paul M said:
Thank you Klatuu for your reply to my post.

I am still having problems getting this thing to work.

I created a new form as instructed and named it "Associate", within the form
I created one combo box and named it "cboAssociate" and linked that to the
table with the Associate names in it. I also created two text boxes and
named them "FromDate" and "ToDate" with a command button named "cmdAssociate"

I tried to use the code in VB that was supplied but got a load of errors.

Note: I am not as savy as the pros in here, please bare with me =0P

:

Create a form to accept the sales associate, and the date range. Include a
command button to print the report. Whether you use the existing button or
add a new one to your current report is not important. It just needs to open
this new form. I suggest a Combo for the Sales Associate and text boxes for
the dates.

Then in the Click event of the Print button, use the values entered in the
control to pass a Where argument to the OpenReport method, then close the
form:

Dim strWhere As String

strWhere = "[ASSOCIATE_ID] = '" & Me.cboAssociate & _
"' AND [SomeDate] BETWEEN #" & Me.txtFromDate & "# AND #" _
Me.txtToDate & "#"
DoCmd.OpenReport "rptSalesAssociates", acViewNormal, , strWhere
DoCmd.Close



:

If someone can help me that would be awesome!

I have a downloaded MDB from microsoft that has been tweeked, well VERY
modified (contact management database) I have added a combo box named "sales
associates" and created a table, also created a relationship for that table
to the data that I want that table to refer to. I have also created a report
named "sales associate".

What I would like to do is create a button (or use the existing "view
reports" button) that will allow me to choose the sales associate (ie Billy,
Joe, Jim or Bob etc.) pick a to and from date, and print a report for that
person for the designated time frame.

I hope this is not asking too much, but you guys are awesome here and there
is always an answer. Thanks in advance
 
ok I think we may be making some head way, here is the code I am using with
the change...

Private Sub cmdAssociate_Click()
Dim strWhere As String
strWhere = "[ASSOCIATE_ID] = '" & Me.cboAssociate & _
"' AND [SomeDate] BETWEEN #" & Me.txtFromDate & "# AND #" & _
Me.txtToDate & "#"
DoCmd.OpenReport "rptSalesAssociates", acViewNormal, , strWhere
DoCmd.Close

End Sub

and here is the new error....

Compile Error:
Method or data member not found

the ".cboAssociate" is grey

Klatuu said:
Create a form to accept the sales associate, and the date range. Include a
command button to print the report. Whether you use the existing button or
add a new one to your current report is not important. It just needs to open
this new form. I suggest a Combo for the Sales Associate and text boxes for
the dates.

Then in the Click event of the Print button, use the values entered in the
control to pass a Where argument to the OpenReport method, then close the
form:

Dim strWhere As String

strWhere = "[ASSOCIATE_ID] = '" & Me.cboAssociate & _
"' AND [SomeDate] BETWEEN #" & Me.txtFromDate & "# AND #" _
Me.txtToDate & "#"
DoCmd.OpenReport "rptSalesAssociates", acViewNormal, , strWhere
DoCmd.Close



Paul M said:
If someone can help me that would be awesome!

I have a downloaded MDB from microsoft that has been tweeked, well VERY
modified (contact management database) I have added a combo box named "sales
associates" and created a table, also created a relationship for that table
to the data that I want that table to refer to. I have also created a report
named "sales associate".

What I would like to do is create a button (or use the existing "view
reports" button) that will allow me to choose the sales associate (ie Billy,
Joe, Jim or Bob etc.) pick a to and from date, and print a report for that
person for the designated time frame.

I hope this is not asking too much, but you guys are awesome here and there
is always an answer. Thanks in advance
 
This is a naming thing. Most of the names I used were made up because I did
not know your real names. Here are somethings to review:
[ASSOCIATE_ID] - Should be the field name in your table that carries the
Associate
Me.cboAssociate - Should be the name of the combo box you use to look up
Associates
[SomeDate] - Should be the field name in your table of the date you want to
filter on.
Me.txtFromDate - Should be the name of the text box were the From Date is
entered.
Me.txtToDate - Should be the name of the text box were the To Date is entered.
rptSalesAssociates - Should be the name of the report you want to run.

Check these names against the object they refer to and change to code to use
the real names. Let me know how that works out.


Paul M said:
ok I think we may be making some head way, here is the code I am using with
the change...

Private Sub cmdAssociate_Click()
Dim strWhere As String
strWhere = "[ASSOCIATE_ID] = '" & Me.cboAssociate & _
"' AND [SomeDate] BETWEEN #" & Me.txtFromDate & "# AND #" & _
Me.txtToDate & "#"
DoCmd.OpenReport "rptSalesAssociates", acViewNormal, , strWhere
DoCmd.Close

End Sub

and here is the new error....

Compile Error:
Method or data member not found

the ".cboAssociate" is grey

Klatuu said:
Create a form to accept the sales associate, and the date range. Include a
command button to print the report. Whether you use the existing button or
add a new one to your current report is not important. It just needs to open
this new form. I suggest a Combo for the Sales Associate and text boxes for
the dates.

Then in the Click event of the Print button, use the values entered in the
control to pass a Where argument to the OpenReport method, then close the
form:

Dim strWhere As String

strWhere = "[ASSOCIATE_ID] = '" & Me.cboAssociate & _
"' AND [SomeDate] BETWEEN #" & Me.txtFromDate & "# AND #" _
Me.txtToDate & "#"
DoCmd.OpenReport "rptSalesAssociates", acViewNormal, , strWhere
DoCmd.Close



Paul M said:
If someone can help me that would be awesome!

I have a downloaded MDB from microsoft that has been tweeked, well VERY
modified (contact management database) I have added a combo box named "sales
associates" and created a table, also created a relationship for that table
to the data that I want that table to refer to. I have also created a report
named "sales associate".

What I would like to do is create a button (or use the existing "view
reports" button) that will allow me to choose the sales associate (ie Billy,
Joe, Jim or Bob etc.) pick a to and from date, and print a report for that
person for the designated time frame.

I hope this is not asking too much, but you guys are awesome here and there
is always an answer. Thanks in advance
 
Great, I got the errors to go away.

Now when I click on the cmd button I get a new window "enter parameter
value" first for "Associate" then for "CallDate" then it says "no record
found" and cancels the report. I believe the code for the command button is
ignoring the combo box and the test boxes I have for the "FromDate" and
"ToDate"

Code used....

Private Sub cmdAssociate_Click()
Dim strWhere As String
strWhere = "[Associate] = '" & Me.cboAssociate & _
"' AND [CallDate] BETWEEN #" & Me.FromDate & "# AND #" & _
Me.ToDate & "#"
DoCmd.OpenReport "Sales Associate", acViewNormal, , strWhere
DoCmd.Close

End Sub

Klatuu said:
This is a naming thing. Most of the names I used were made up because I did
not know your real names. Here are somethings to review:
[ASSOCIATE_ID] - Should be the field name in your table that carries the
Associate
Me.cboAssociate - Should be the name of the combo box you use to look up
Associates
[SomeDate] - Should be the field name in your table of the date you want to
filter on.
Me.txtFromDate - Should be the name of the text box were the From Date is
entered.
Me.txtToDate - Should be the name of the text box were the To Date is entered.
rptSalesAssociates - Should be the name of the report you want to run.

Check these names against the object they refer to and change to code to use
the real names. Let me know how that works out.


Paul M said:
ok I think we may be making some head way, here is the code I am using with
the change...

Private Sub cmdAssociate_Click()
Dim strWhere As String
strWhere = "[ASSOCIATE_ID] = '" & Me.cboAssociate & _
"' AND [SomeDate] BETWEEN #" & Me.txtFromDate & "# AND #" & _
Me.txtToDate & "#"
DoCmd.OpenReport "rptSalesAssociates", acViewNormal, , strWhere
DoCmd.Close

End Sub

and here is the new error....

Compile Error:
Method or data member not found

the ".cboAssociate" is grey

Klatuu said:
Create a form to accept the sales associate, and the date range. Include a
command button to print the report. Whether you use the existing button or
add a new one to your current report is not important. It just needs to open
this new form. I suggest a Combo for the Sales Associate and text boxes for
the dates.

Then in the Click event of the Print button, use the values entered in the
control to pass a Where argument to the OpenReport method, then close the
form:

Dim strWhere As String

strWhere = "[ASSOCIATE_ID] = '" & Me.cboAssociate & _
"' AND [SomeDate] BETWEEN #" & Me.txtFromDate & "# AND #" _
Me.txtToDate & "#"
DoCmd.OpenReport "rptSalesAssociates", acViewNormal, , strWhere
DoCmd.Close



:

If someone can help me that would be awesome!

I have a downloaded MDB from microsoft that has been tweeked, well VERY
modified (contact management database) I have added a combo box named "sales
associates" and created a table, also created a relationship for that table
to the data that I want that table to refer to. I have also created a report
named "sales associate".

What I would like to do is create a button (or use the existing "view
reports" button) that will allow me to choose the sales associate (ie Billy,
Joe, Jim or Bob etc.) pick a to and from date, and print a report for that
person for the designated time frame.

I hope this is not asking too much, but you guys are awesome here and there
is always an answer. Thanks in advance
 
Thank you Klatuu for your help the code you gave me did point me in the right
direction..... this is what I ended up with

Dim strWhere As String
strWhere = "[Associate] = '" & Me.cboAssociate & _
"' AND [Call Date] BETWEEN #" & Me.FromDate & "# AND #" & _
Me.ToDate & "#"
DoCmd.OpenReport "Associate Appointment Listing", acViewNormal, , strWhere
DoCmd.Close

I don't know what I would have done without your help A++++++

Klatuu said:
This is a naming thing. Most of the names I used were made up because I did
not know your real names. Here are somethings to review:
[ASSOCIATE_ID] - Should be the field name in your table that carries the
Associate
Me.cboAssociate - Should be the name of the combo box you use to look up
Associates
[SomeDate] - Should be the field name in your table of the date you want to
filter on.
Me.txtFromDate - Should be the name of the text box were the From Date is
entered.
Me.txtToDate - Should be the name of the text box were the To Date is entered.
rptSalesAssociates - Should be the name of the report you want to run.

Check these names against the object they refer to and change to code to use
the real names. Let me know how that works out.


Paul M said:
ok I think we may be making some head way, here is the code I am using with
the change...

Private Sub cmdAssociate_Click()
Dim strWhere As String
strWhere = "[ASSOCIATE_ID] = '" & Me.cboAssociate & _
"' AND [SomeDate] BETWEEN #" & Me.txtFromDate & "# AND #" & _
Me.txtToDate & "#"
DoCmd.OpenReport "rptSalesAssociates", acViewNormal, , strWhere
DoCmd.Close

End Sub

and here is the new error....

Compile Error:
Method or data member not found

the ".cboAssociate" is grey

Klatuu said:
Create a form to accept the sales associate, and the date range. Include a
command button to print the report. Whether you use the existing button or
add a new one to your current report is not important. It just needs to open
this new form. I suggest a Combo for the Sales Associate and text boxes for
the dates.

Then in the Click event of the Print button, use the values entered in the
control to pass a Where argument to the OpenReport method, then close the
form:

Dim strWhere As String

strWhere = "[ASSOCIATE_ID] = '" & Me.cboAssociate & _
"' AND [SomeDate] BETWEEN #" & Me.txtFromDate & "# AND #" _
Me.txtToDate & "#"
DoCmd.OpenReport "rptSalesAssociates", acViewNormal, , strWhere
DoCmd.Close



:

If someone can help me that would be awesome!

I have a downloaded MDB from microsoft that has been tweeked, well VERY
modified (contact management database) I have added a combo box named "sales
associates" and created a table, also created a relationship for that table
to the data that I want that table to refer to. I have also created a report
named "sales associate".

What I would like to do is create a button (or use the existing "view
reports" button) that will allow me to choose the sales associate (ie Billy,
Joe, Jim or Bob etc.) pick a to and from date, and print a report for that
person for the designated time frame.

I hope this is not asking too much, but you guys are awesome here and there
is always an answer. Thanks in advance
 
Glad I could help.

Paul M said:
Thank you Klatuu for your help the code you gave me did point me in the right
direction..... this is what I ended up with

Dim strWhere As String
strWhere = "[Associate] = '" & Me.cboAssociate & _
"' AND [Call Date] BETWEEN #" & Me.FromDate & "# AND #" & _
Me.ToDate & "#"
DoCmd.OpenReport "Associate Appointment Listing", acViewNormal, , strWhere
DoCmd.Close

I don't know what I would have done without your help A++++++

Klatuu said:
This is a naming thing. Most of the names I used were made up because I did
not know your real names. Here are somethings to review:
[ASSOCIATE_ID] - Should be the field name in your table that carries the
Associate
Me.cboAssociate - Should be the name of the combo box you use to look up
Associates
[SomeDate] - Should be the field name in your table of the date you want to
filter on.
Me.txtFromDate - Should be the name of the text box were the From Date is
entered.
Me.txtToDate - Should be the name of the text box were the To Date is entered.
rptSalesAssociates - Should be the name of the report you want to run.

Check these names against the object they refer to and change to code to use
the real names. Let me know how that works out.


Paul M said:
ok I think we may be making some head way, here is the code I am using with
the change...

Private Sub cmdAssociate_Click()
Dim strWhere As String
strWhere = "[ASSOCIATE_ID] = '" & Me.cboAssociate & _
"' AND [SomeDate] BETWEEN #" & Me.txtFromDate & "# AND #" & _
Me.txtToDate & "#"
DoCmd.OpenReport "rptSalesAssociates", acViewNormal, , strWhere
DoCmd.Close

End Sub

and here is the new error....

Compile Error:
Method or data member not found

the ".cboAssociate" is grey

:

Create a form to accept the sales associate, and the date range. Include a
command button to print the report. Whether you use the existing button or
add a new one to your current report is not important. It just needs to open
this new form. I suggest a Combo for the Sales Associate and text boxes for
the dates.

Then in the Click event of the Print button, use the values entered in the
control to pass a Where argument to the OpenReport method, then close the
form:

Dim strWhere As String

strWhere = "[ASSOCIATE_ID] = '" & Me.cboAssociate & _
"' AND [SomeDate] BETWEEN #" & Me.txtFromDate & "# AND #" _
Me.txtToDate & "#"
DoCmd.OpenReport "rptSalesAssociates", acViewNormal, , strWhere
DoCmd.Close



:

If someone can help me that would be awesome!

I have a downloaded MDB from microsoft that has been tweeked, well VERY
modified (contact management database) I have added a combo box named "sales
associates" and created a table, also created a relationship for that table
to the data that I want that table to refer to. I have also created a report
named "sales associate".

What I would like to do is create a button (or use the existing "view
reports" button) that will allow me to choose the sales associate (ie Billy,
Joe, Jim or Bob etc.) pick a to and from date, and print a report for that
person for the designated time frame.

I hope this is not asking too much, but you guys are awesome here and there
is always an answer. Thanks in advance
 

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

Back
Top