Sorting by date in a report

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

Guest

I thought I was done (sorry guys), but now I have been given another task....

before I asked for help in sorting "Associates" and "Dates" and now I have
been given a new task to make a button sort by just the date for all
Associates.

this is the cdoe I have for the other button

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

Same Report this time I just need to sort by date, thanks in advance
 
Do you mean SORT or do you mean SELECT? Your posted code SELECTS a group of
records and has nothing to do with the order the records are sorted (display
order).

If you mean SELECT, then all you need to do is change StrWhere so it doesn't
include the [Associate] criteria.

strWhere = "[Call Date] BETWEEN #" & Me.FromDate & "# AND #" & Me.ToDate &
"#"
 
Thank you Alan and John,

both were very helpful in creating a solution for my database

Code used.......

Private Sub cmdListing_Click()

Dim strWhere As String
strWhere = "[Call Date] BETWEEN #" & Me.FromDate & "# AND #" & Me.ToDate
& "#"
DoCmd.OpenReport "Call Center Listing", acViewNormal, , strWhere
DoCmd.Close
End Sub

I knew this forum would have an answer as it always does A++++++

John Spencer said:
Do you mean SORT or do you mean SELECT? Your posted code SELECTS a group of
records and has nothing to do with the order the records are sorted (display
order).

If you mean SELECT, then all you need to do is change StrWhere so it doesn't
include the [Associate] criteria.

strWhere = "[Call Date] BETWEEN #" & Me.FromDate & "# AND #" & Me.ToDate &
"#"

Paul M said:
I thought I was done (sorry guys), but now I have been given another
task....

before I asked for help in sorting "Associates" and "Dates" and now I have
been given a new task to make a button sort by just the date for all
Associates.

this is the cdoe I have for the other button

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

Same Report this time I just need to sort by date, 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