Report Case by Dates

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
 
B

BruceM

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.
 

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

Similar Threads


Top