By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,369 Members | 1,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,369 IT Pros & Developers. It's quick & easy.

DCount and Dates

P: n/a
Hi All,

I've asked about this before, and people were very helpful, and I have
used the advise quite a bit, however I have run into a spot of
trouble...

I have a form that the users uses to change the salary of an employee.
This has ChangeDate on it. When the Change button is clicked, it should
count how many changes have the same or later date to that input. I went
about this like this:

Dim dupNum
dupNum = DCount("[EmpID]", "tblSalaryChanges", "[EmpID]="_
& Me.EmpID & " AND [ChangeDate]>=#" & Me.ChangeDate.Value_
& "#")

However, this seems to return the amount of changes in the table for
that emplyee! Can anyone tell me where the error in the code is?

TIA

Alec Christie
alec_e_christie(at)hotmail(dot)com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
I'm not sure at a glance what could be causing the error, Alec, but you
could try replacing:

[ChangeDate]>=#" & Me.ChangeDate.Value & "#"

with

DateDiff("d",[ChangeDate],#" & Me.ChangeDate.Value & "#) < 0"

and see if that makes a difference. (I haven't tested that formula, so
apologies in advance if it needs a little tweaking!)

------------
LoopyNZ
------------

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #2

P: n/a
LoopyNZ,

Thanks for the tip, I have managed to implement that, however it did
require a lengthy if statement, o well!

Thanks again!

Alec Christie
alec_e_christie(at)hotmail(dot)com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #3

P: n/a
Hi again,

Well it now turns out that isnt working so well... Anyone have any ideas
as to why my original code isnt working?

TIA

Alec Christie
alec_e_christie(at)hotmail(dot)com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #4

P: n/a
It is not entirely clear from your post what is happening that is not
correct, in either code.

Please be more specific about the results, in both case -- as well as what
the desired results were. Someone is much more likely to be able to help you
is you provide this information....
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies
Windows International Division

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Alec" <alec_e_christie at hotmail dot com> wrote in message
news:41**********************@news.newsgroups.ws.. .
Hi again,

Well it now turns out that isnt working so well... Anyone have any ideas
as to why my original code isnt working?

TIA

Alec Christie
alec_e_christie(at)hotmail(dot)com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #5

P: n/a
Hi again all,

I have managed to complete the required task using the second code, i
did the most stupid thing of putting the the dates into DataDiff() the
wrong way round!

Alec Christie
alec_e_christie(at)hotmail(dot)com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.