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

#error using Dsum

222 100+
Hello

I have a subform base on query. I used a textbox with a control source =

Expand|Select|Wrap|Line Numbers
  1. =nz(DCount("ref_ID","checklist","[profession_id]=" & [ProfessionId] & "and" & "[passed]= " & True & " and" & "[blockid]='" & [Forms]![block_id]![block_id] & "'  "),0)
Each time we add a new record to the subform it works properly unless the last record (I mean the newrecord that it doesn't containt any values)It is #ERROR.
Actually for me it is not a problem but for my boss it is :S.

He asked me to change it to 0 , "" or anything else then #error.

Any Idea how to do that ? NZ function is not working


CHEERS;

WASSIM S DACCACHE
Aug 12 '08 #1
2 2190
Stewart Ross
2,545 Expert Mod 2GB
Hi Wassim. The null values that cause the error relate to the parameters passed to the DCount function itself, not to the result of the DCount, so Nz applied to the DCount result does not help.

I suggest you use an IIF to test one of the underlying field values and if the field is null return a 0 in place of the DCount:

Expand|Select|Wrap|Line Numbers
  1. =IIF(IsNull([ProfessionID]), 0, DCount("ref_ID","checklist","[profession_id] = " & [ProfessionId] & " AND [passed] = " & True & " AND [blockid] = '" & [Forms]![block_id]![block_id] & "'"))
I have adjusted the spacing of the arguments slightly - you were leaving out spaces between some operators and concatenating others without really needing to.

-Stewart
Aug 12 '08 #2
wassimdaccache
222 100+
Hi Wassim. The null values that cause the error relate to the parameters passed to the DCount function itself, not to the result of the DCount, so Nz applied to the DCount result does not help.

I suggest you use an IIF to test one of the underlying field values and if the field is null return a 0 in place of the DCount:

Expand|Select|Wrap|Line Numbers
  1. =IIF(IsNull([ProfessionID]), 0, DCount("ref_ID","checklist","[profession_id] = " & [ProfessionId] & " AND [passed] = " & True & " AND [blockid] = '" & [Forms]![block_id]![block_id] & "'"))
I have adjusted the spacing of the arguments slightly - you were leaving out spaces between some operators and concatenating others without really needing to.

-Stewart
I appreciate your Kind help for me. It is working properly with the criteria optimized

Best regards,

WASSIM S DACCACHE
Aug 12 '08 #3

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

Similar topics

1
by: rwalker | last post by:
Error number 429 - COM object with CLSID {000209F0-0000-0000-C000-000000000046} is either not valid or not registered. Intermittent occurance of this error. Using Word.Global to run word macro...
3
by: Andrew Luke | last post by:
Hi all you C++ guru's! I'm 'very, very' new to C++ and I'm having a little trouble configuring my VS environment I think - when I try and compile some sample code I'm getting the following...
0
by: seanseaghan | last post by:
New to this group, so greetings all! I am trying to develop query syntax in Access 2000 to accomplish the following: Imagine you are in an accounting dept. and you are working on a...
1
by: Eric | last post by:
Using the 1.1 framework. We are using a newly created instance of a RichTextBox Class in our server code to manipulate RTF that is stored in the database. To clarify, we are not using or...
1
by: ns2k | last post by:
I add reference office.dll and Microsoft Office Excel Component to my project and use : --------------------------------------- Dim App As Excel.Application, BarName as String ... Dim Bar As...
11
by: Frankie | last post by:
Hello: New user here...first post to group. I'm getting an SQL syntax error when I try to run the following query: $query = sprintf("SELECT itemNumber, entryDate, modifyDate, thumbnailURL,...
2
by: ckpoll2 | last post by:
Hello, I'm trying to build a text box in a form that will add hours for a two week period. I have created a query to return the hours in the two week range, but the same name and hour type will...
0
by: sa6113 | last post by:
I am using this code to connect to a windows machine using paramiko, I have installed sshd on the machine and it works properly: sock.connect((hostname, port)) t = paramiko.Transport(sock)...
5
by: munkee | last post by:
Right a bit of a headache here. I basically wanted to create a cumulative total of a percentage through a query. To put that in a more physical way: NCTYPE Freq cpercent x 2 ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.