473,394 Members | 1,773 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,394 software developers and data experts.

Dcount woes

14
Afternoon,

new to here and new to programming. Well I'm not, I'm just not good at it!!

I am trying to count the number of records with a priority of "high" that also has a blank completed date. I assume it's possible?

My syntax (that's not working) is -

intStore = DCount("[Job Reference no]", "mainjobform", "[Priority rating]= 'high'" And "[Date completed] = ''")

Please can someone help before I throw myself out of the window!!!

Thanks in anticipation. Graeme
Dec 12 '06 #1
6 1858
leeg
14
Afternoon,

new to here and new to programming. Well I'm not, I'm just not good at it!!

I am trying to count the number of records with a priority of "high" that also has a blank completed date. I assume it's possible?

My syntax (that's not working) is -

intStore = DCount("[Job Reference no]", "mainjobform", "[Priority rating]= 'high'" And "[Date completed] = ''")

Please can someone help before I throw myself out of the window!!!

Thanks in anticipation. Graeme
Sorry, here is all my code for this

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.  
  3. 'On Load of the switchboard check Jobs table for any incomplete jobs
  4.  
  5. Dim intStore As Integer
  6.  
  7. 'Count of incomplete jobs that are high priority and incomplete
  8. intStore = DCount("[Job Reference no]", "mainjobform", "[Priority rating]= 'high'" And "[Date completed] = ''")
  9. 'If count of incomplete jobs is zero display switchboard
  10. 'Else display message box detailing amount of jobs
  11. 'and give the user the option as to whether to view these or not.
  12.     If intStore = 0 Then
  13.             Exit Sub
  14.                 Else
  15.                     If MsgBox("There are " & intStore & " incomplete High priority jobs" & _
  16.                     vbCrLf & vbCrLf & "Would you like to see these now?", _
  17.                     vbYesNo, "You have incomplete high priority jobs...") = vbYes Then
  18.                     DoCmd.Close
  19.                     DoCmd.OpenForm "FormOutstandingHighJobs", acNormal
  20.                 Else
  21.             Exit Sub
  22.         End If
  23.     End If
  24. End Sub


Thanks
Dec 12 '06 #2
NeoPa
32,556 Expert Mod 16PB
Expand|Select|Wrap|Line Numbers
  1. intStore = DCount("[Job Reference no]", _
  2.                   "TableorQueryName", _
  3.                   "((LCase([Priority rating])='high') " & _
  4.                   "And (Nz([Date completed],'')=''))")
This is a start but without the Table MetaData I don't know for sure how the check for 'High should be done.
Here is an example of how to post table MetaData :
Posting Table/Dataset MetaData
Expand|Select|Wrap|Line Numbers
  1. Table Name=tblStudent
  2. StudentID; Autonumber; PK
  3. Family; String; FK
  4. Name; String
  5. University; String; FK
  6. MaxMark; Numeric
  7. MinMark; Numeric
Dec 12 '06 #3
MMcCarthy
14,534 Expert Mod 8TB
Afternoon,

new to here and new to programming. Well I'm not, I'm just not good at it!!

I am trying to count the number of records with a priority of "high" that also has a blank completed date. I assume it's possible?

My syntax (that's not working) is -

intStore = DCount("[Job Reference no]", "mainjobform", "[Priority rating]= 'high'" And "[Date completed] = ''")

Please can someone help before I throw myself out of the window!!!

Thanks in anticipation. Graeme
You can't run DCount against the form. You have to run it on the table or query on which the form is based. You also have too many quotes which I have removed.

Mary

Expand|Select|Wrap|Line Numbers
  1.  
  2. intStore = DCount("[Job Reference no]", "table/query name", "[Priority rating]= 'high' And [Date completed] Is Null")
  3.  
Dec 12 '06 #4
leeg
14
Mary, I love you!!!! And thanks to Neopa

I tried every permutation of syntax that I could think of. Greatly appreciate your time and skills. Thankyou.

I wasn't trying to dcount against a form. The table name is actually mainjobform :o) Can you tell I'm not a programmer!!!!

Regards, Graeme
Dec 14 '06 #5
NeoPa
32,556 Expert Mod 16PB
Mary, I love you!!!! And thanks to Neopa

I tried every permutation of syntax that I could think of. Greatly appreciate your time and skills. Thankyou.

I wasn't trying to dcount against a form. The table name is actually mainjobform :o) Can you tell I'm not a programmer!!!!

Regards, Graeme
Lol Graeme.

In answer to your question - No.
I'm afraid that that sort of thing is quite common even among programmers.
Very few understand that conventions and consistency are elements that they, as programmers, will benefit from greatly :(.
Dec 14 '06 #6
MMcCarthy
14,534 Expert Mod 8TB
Mary, I love you!!!! And thanks to Neopa

I tried every permutation of syntax that I could think of. Greatly appreciate your time and skills. Thankyou.

I wasn't trying to dcount against a form. The table name is actually mainjobform :o) Can you tell I'm not a programmer!!!!

Regards, Graeme
You're welcome Graeme.

Mary
Dec 14 '06 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: jdph40 | last post by:
I posted this problem previously and received excellent help from Wayne Morgan. However, I still have an unanswered question. My form (frmVacationWeeks) is opened from the OnClick event of a...
1
by: Megan | last post by:
Hi Everybody- I've been reading some of the posts about DCOUNT, and I haven't yet found an answer; so, I'm posting this question. I have a report that I'm trying to use DCOUNT on to compute...
4
by: Will | last post by:
Hi, I had a DCount within a module on records in a table where CustSuffix = 0. I now need to DCount where CustSuffix = 0 and the type of cost Suffix (Suffix in table) = G. I can't get both...
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...
2
by: Paul T. RONG | last post by:
Hi, I have a problem with DCount, the following code doesn't work: DCount("", "qryOrder", "( = Me! AND = 'drink')" > 0 Please help. Thank you.
3
by: BerkshireGuy | last post by:
I am having difficulty with using the Dcount function. I am trying to return the number of records from qryIndividualFeedbackDetail where the TimelyManner field is set to 4. So, in the new...
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: ChasW | last post by:
Greetings, I have a form that uses a query as its record source. In the form I have a text box that uses this as its control source: =DCount("", "qry_Search_by_Name") The DCount function...
2
by: Wingz | last post by:
Hiya, Fairly new to Access and was wondering what the best way to perform Dcounts on groups in an Access report. For example, I have 10 employees and the different instances of jobs they can...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.