Tezcatlipoca
Registered User.
- Local time
- Today, 22:01
- Joined
- Mar 13, 2003
- Messages
- 246
I'm not too sure if this is the right way to go about this, but I have a form - frmReports - on which is a list box, showing all the database members. When I click on any member, an AfterUpdate event sends that member's number to a hidden unbound textbox, Number. This is then used in a number of areas around the form to generate statistics. For example, a visible textbox on the form contains the ControlSource code:
so it shows the total number of contacts by whichever member is selected from the list box.
All this works great. However, just make like more complicated, I now want to add the ability to filter the result by the date the record was logged.
I have a table of records, tblLogs, consisting of the fields ID (primary key), MemberNumber and CallLog. CallLog is a UK format General Date (so time and date), and gets added everytime a new record is created.
On my form, there are two textboxes (txtStartDate and txtEndDate). Each has a calendar button next to it, which can be used to fill out the boxes in UK Short Date format.
Soo, after that lengthy explaination, I'm now trying to edit the above code so it takes into account these two dates, and only counts up records between them. I tried this:
but it just returns a syntax error. I'm also not entirely sure whether this is the right approach at all, given that the CallLog stamp is in General Date (so time and date) format, and the two textboxes are in Short Date formats.
Can anyone assist?
Code:
=DCount("[ID]","tblLogs","[MemberNumber] = '" & [Number] & "'")
so it shows the total number of contacts by whichever member is selected from the list box.
All this works great. However, just make like more complicated, I now want to add the ability to filter the result by the date the record was logged.
I have a table of records, tblLogs, consisting of the fields ID (primary key), MemberNumber and CallLog. CallLog is a UK format General Date (so time and date), and gets added everytime a new record is created.
On my form, there are two textboxes (txtStartDate and txtEndDate). Each has a calendar button next to it, which can be used to fill out the boxes in UK Short Date format.
Soo, after that lengthy explaination, I'm now trying to edit the above code so it takes into account these two dates, and only counts up records between them. I tried this:
Code:
=DCount("ID", "tblLogs",""[MemberNumber] = '" & [Number] & "' AND [CallLog] >=Forms!frmReports![txtStartDate] AND <=Forms!frmReports![txtEndDate]")
but it just returns a syntax error. I'm also not entirely sure whether this is the right approach at all, given that the CallLog stamp is in General Date (so time and date) format, and the two textboxes are in Short Date formats.
Can anyone assist?