Report Case by Dates

  • Thread starter Thread starter Bob Vance
  • Start date Start date
B

Bob Vance

On the same form frmHorseManagement I have 2 text boxes tbStartdate and
tbEndDate, can I get this case to sort by those 2 dates?
Case "Category Print Remark by Date"
strSQL = "SELECT * FROM tblRemarks WHERE HorseID=" _
& Form_frmHorseManagement.tbHorseIdMain.value & " and Category='" &
Form_frmHorseManagement.cbCategoryHorseMain & "' ORDER BY dtDate
DESC,tblRemarks.Remark ASC;"
SrNo.ControlSource = "SrNo"
tbHorseName.Visible = True
SrNo.Visible = True
tbDate.Visible = True
lblDate.Visible = True

lblRemarkID.Visible = False
tbRemarkID.Visible = False
tbHorseName.ControlSource =
"=[Forms]![frmHorsemanagement]![tbNameToDisplayMain]"
tbRemarks.Visible = False
tbRemarkID.ControlSource = ""
tbHorseName.Visible = True
 
What is the name of the form where this code is located? I don't understand
the reason for the Case line unless it is part of a Select Case that you
haven't included.

I am a little puzzled by your setting the Control Source by code. It can be
done, but I wonder if you don't just want to set the value of unbound text
boxes in some cases.

That being said, if tbStartDate and tbEndDate are bound text boxes you
should be able to sort by the Control Source fields. Your SQL shows sorting
by dtDate, but I don't know what that is. Also, what happens with the SQL?
You set it, but then don't do anything with it in the code you posted.
 
Back
Top