473,397 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

DCount and Dates

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
5 1402
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dan Leeder | last post by:
stroccur = DCount("", "empnotes", " = " & Chr(34) & Me.Rpt_Card_Type & Chr(34) & " And = " & Me.SSN & " And #" & & "# > " & DateSerial(Year(Me.datetime) - 1, Month(Me.datetime),...
3
by: Alec | last post by:
Hi All, I am trying to use the DCount and DLookup functions with the WHERE expression set to: "DateToDo <= #" & Date & "#" to display all items with their DateToDo set to the current date or...
6
by: Mike Conklin | last post by:
This one really has me going. Probably something silly. I'm using dcount for a report to determine the number of different types of tests proctored in a semester. My report is based on a...
6
by: jstaggs39 | last post by:
I want to create a Dcount and an If...Then...Else statement to count the number of records in a table based on the date that is entered to run the form. The If....Else statment comes in because if...
7
by: kaosyeti | last post by:
hey.. i have a control in a report that needs to count the records from a table that match the parameters that the user selects when creating the report. the report is created with...
2
by: Kaspa | last post by:
Hello I am trying to create dcount field but is not working I have tried every way possible and I can't get it to work. here is my code: =Dcount("","qryTotalscratched"," in (6,7,8,9) and ...
2
by: Kaspa | last post by:
Hello I am trying to create dcount field but is not working I have tried every way possible and I can't get it to work. here is my code: =Dcount("","qryTotalscratched"," in (6,7,8,9) and ...
3
by: psuaudi | last post by:
I am trying to use the following code, but I think there is an error in my syntax: Count = DCount("", "Change Dates", " = '" & !! & "' AND CVDate(Int( #" & & "# )) = #" & (Date) & "#") I...
3
by: ringer | last post by:
I am trying to add a functionality into a db I use for my checkbook that will help me plan for and save money for future large expenses. Into a table called tblFutureTransactions I want to enter...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.