Oct 20, 2007 #1 ftook Programmer Joined Dec 4, 2006 Messages 80 Location GB Im trying to count how many records have a null entry in field [credit], ive tried : Me.var1 = DCount("[Pono]", "PO Returns", "[credit] = ''")) [credit] is a text field doesnt seem to count correctly - can anyone help please ?
Im trying to count how many records have a null entry in field [credit], ive tried : Me.var1 = DCount("[Pono]", "PO Returns", "[credit] = ''")) [credit] is a text field doesnt seem to count correctly - can anyone help please ?
Oct 20, 2007 1 #2 Ed2020 Programmer Joined Nov 12, 2001 Messages 1,899 Location GB [credit] = '' will count records where the field is empty, not null (there is a difference). You'll need to use Code: Me.var1 = DCount("[Pono]", "PO Returns", "[credit] Is Null")) Ed Metcalfe Please do not feed the trolls..... Upvote 0 Downvote
[credit] = '' will count records where the field is empty, not null (there is a difference). You'll need to use Code: Me.var1 = DCount("[Pono]", "PO Returns", "[credit] Is Null")) Ed Metcalfe Please do not feed the trolls.....
Oct 20, 2007 Thread starter #3 ftook Programmer Joined Dec 4, 2006 Messages 80 Location GB Thank you Ed - worked great *** Upvote 0 Downvote
Oct 20, 2007 #4 Ed2020 Programmer Joined Nov 12, 2001 Messages 1,899 Location GB You're welcome. BTW - The difference between the two can be regarded as: Null - Value is unknown. Empty ("") - No value for this record. Sometimes you will want to count one or the other value, sometimes you will want to count both. Ed Metcalfe. Please do not feed the trolls..... Upvote 0 Downvote
You're welcome. BTW - The difference between the two can be regarded as: Null - Value is unknown. Empty ("") - No value for this record. Sometimes you will want to count one or the other value, sometimes you will want to count both. Ed Metcalfe. Please do not feed the trolls.....
Oct 20, 2007 Thread starter #5 ftook Programmer Joined Dec 4, 2006 Messages 80 Location GB ive extended the function, and it now gives type mismatch If DCount("[Pono]", "PO Returns", "[credit] Is Null" And "[pono] = " & Me.pno) = 0 pono is integer where am i going wrong Upvote 0 Downvote
ive extended the function, and it now gives type mismatch If DCount("[Pono]", "PO Returns", "[credit] Is Null" And "[pono] = " & Me.pno) = 0 pono is integer where am i going wrong
Oct 20, 2007 1 #6 MajP Technical User Joined Aug 27, 2005 Messages 9,382 Location US This where criteria needs to be a string so: "[credit] Is Null And [pono] = " & Me.pno with AND outstide the parentheses it looks to vba as a variable Upvote 0 Downvote
This where criteria needs to be a string so: "[credit] Is Null And [pono] = " & Me.pno with AND outstide the parentheses it looks to vba as a variable