A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Null Values, #Error and Forms



 
 
Thread Tools Display Modes
  #1  
Old March 13th, 2007, 10:48 PM posted to microsoft.public.access.forms
Paputxi
external usenet poster
 
Posts: 26
Default Null Values, #Error and Forms

I want to display the number of records in a query where I set the field
=[Form}.[RecordsetClone].[RecordCount] in the ControlSource property. It
works fine except that when there are no records found, I get an "#Error"
message. I tried an IIF clause to set it to '0' if it were null, but
couldn't get it to work. Any suggestions on how to get it to display a zero
would be greatly appreciated. Thanks in advance.
  #2  
Old March 14th, 2007, 03:28 AM posted to microsoft.public.access.forms
ruralguy via AccessMonster.com
external usenet poster
 
Posts: 1,172
Default Null Values, #Error and Forms

Have you looked at the IsError() function?

Paputxi wrote:
I want to display the number of records in a query where I set the field
=[Form}.[RecordsetClone].[RecordCount] in the ControlSource property. It
works fine except that when there are no records found, I get an "#Error"
message. I tried an IIF clause to set it to '0' if it were null, but
couldn't get it to work. Any suggestions on how to get it to display a zero
would be greatly appreciated. Thanks in advance.


--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via http://www.accessmonster.com

  #3  
Old March 14th, 2007, 03:25 PM posted to microsoft.public.access.forms
SteveS
external usenet poster
 
Posts: 132
Default Null Values, #Error and Forms

Works fine for me. i am using A2003.

I added an unbound textbox to the header of a form with a query for the
record source of the form.

In the control source of the textbox I entered:

=[Form].[RecordsetClone].[RecordCount]


It displays 0 (zero) when there are no records and the number of record
otherwise.

AFAIK, the recordcount should never be Null. Null would mean that the count
is unknown. If there are no records in a table or query, the recordcount
should be zero.

Maybe you could tell us a little more about what you are trying to do? What
you have tried; post the SQL of the query for the form...


HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


"Paputxi" wrote:

I want to display the number of records in a query where I set the field
=[Form}.[RecordsetClone].[RecordCount] in the ControlSource property. It
works fine except that when there are no records found, I get an "#Error"
message. I tried an IIF clause to set it to '0' if it were null, but
couldn't get it to work. Any suggestions on how to get it to display a zero
would be greatly appreciated. Thanks in advance.

  #4  
Old March 14th, 2007, 07:43 PM posted to microsoft.public.access.forms
Paputxi
external usenet poster
 
Posts: 26
Default Null Values, #Error and Forms

Since submitting my post, I noticed that the problem is with my query. I
have two queries, say Query1 and Query2, where I list the returned records in
their respective subform. I noticed that Query 1 indicates where I can input
a new, blank record, i.e., it shows (auto number) in the first field at the
end of the listed records. (Sorry for my ignorance on the proper
terminology.) If there are no records returned, the query/subform shows only
a new, blank record (auto number info) and the record count does show as 0.
So it is okay.

Query2, however, does not have the extra, blank record at the end. So the
subform just shows the field names but no new or blank record. For this
case, the count show #Error.

The problem may be in the way I've constructed the relationships between the
tables that are used in the queries. Both have different types of
relationships. In both, I set the Allow Additions (I think that's the right
one) property to Yes. So, I'm not sure how I will correct the problem. Oh,
well.

"SteveS" wrote:

Works fine for me. i am using A2003.

I added an unbound textbox to the header of a form with a query for the
record source of the form.

In the control source of the textbox I entered:

=[Form].[RecordsetClone].[RecordCount]


It displays 0 (zero) when there are no records and the number of record
otherwise.

AFAIK, the recordcount should never be Null. Null would mean that the count
is unknown. If there are no records in a table or query, the recordcount
should be zero.

Maybe you could tell us a little more about what you are trying to do? What
you have tried; post the SQL of the query for the form...


HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


"Paputxi" wrote:

I want to display the number of records in a query where I set the field
=[Form}.[RecordsetClone].[RecordCount] in the ControlSource property. It
works fine except that when there are no records found, I get an "#Error"
message. I tried an IIF clause to set it to '0' if it were null, but
couldn't get it to work. Any suggestions on how to get it to display a zero
would be greatly appreciated. Thanks in advance.

  #5  
Old March 15th, 2007, 07:32 PM posted to microsoft.public.access.forms
Paputxi
external usenet poster
 
Posts: 26
Default Null Values, #Error and Forms

I was able to workaround my problem using a combination of the IIF and
IsError functions. Thanks for the suggestion, ruralguy!

"ruralguy via AccessMonster.com" wrote:

Have you looked at the IsError() function?

Paputxi wrote:
I want to display the number of records in a query where I set the field
=[Form}.[RecordsetClone].[RecordCount] in the ControlSource property. It
works fine except that when there are no records found, I get an "#Error"
message. I tried an IIF clause to set it to '0' if it were null, but
couldn't get it to work. Any suggestions on how to get it to display a zero
would be greatly appreciated. Thanks in advance.


--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via http://www.accessmonster.com


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:16 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.