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  

Need help with something from MVP website



 
 
Thread Tools Display Modes
  #1  
Old December 13th, 2005, 11:25 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Need help with something from MVP website

Hi all,

I have encountered a little problem which I found some information about on
the MVP website http://www.mvps.org/access/forms/frm0022.htm
But unfortunately, I am not strong enough to crack the code and implement
this on my DB. Can anyone explain this to me in layman terms... where, what
to change, how...

On subform... record field I have this
DS1 =IIF([specialisme]=[DoctorSpeciality1];1;0)
to count the records in case the condition is true. (CountIf didn't work so
good)
Subform also has a total of this in the footer.
=Count([DS1])
This works fine...
Now I try to put over the total DS1 to the main form and I get #Error when
no records in the subform...

Thanks for the assistance
Your humble apprentice,

Ben


--
Novice
  #2  
Old December 13th, 2005, 12:14 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Need help with something from MVP website

You need to create a standard code module.

click on the "modules" tab in the main access window.

If you already have a module, then you can simply use that exist code module
(each module can have "MANY" code functions that your write).

If you don't have a module, then simply click on "new", and you will jump
right into the code editor. Simply "paste" the following code (from that web
site).

Here is the code you paste:

'This code was originally written by Keri Hardwick.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code Courtesy of
'Keri Hardwick
'
Function nnz(testvalue As Variant) As Variant
'Not Numeric return zero
If Not (IsNumeric(testvalue)) Then
nnz = 0
Else
nnz = testvalue
End If
End Function


Now once you put the above code in the module...click on the save button.
You can use the "default" module name (ie: module1, module2..etc..these
number just like forms, or queries when you don't give them a name).

after you save, then close the code editor (click on the 'x' in the upright
right hand corner).

At this point in time, you are now able to use the nnz function anywhere.

So, in your case, change you expression in the "main" code for from

=nzz( you existing expression in the main form goes here )

All that the nzz function does is check if nothing is return..and thus
changes it to a zero...


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada

http://www.members.shaw.ca/AlbertKallal


  #3  
Old December 13th, 2005, 12:33 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Need help with something from MVP website

Wonderful.

This was extremely simplified and I understand it now. I believe that you
just multiplied my understanding of Access by 50.
It works perfectly !

Greetings,

Ben

--
Novice


"Albert D.Kallal" wrote:

You need to create a standard code module.

click on the "modules" tab in the main access window.

If you already have a module, then you can simply use that exist code module
(each module can have "MANY" code functions that your write).

If you don't have a module, then simply click on "new", and you will jump
right into the code editor. Simply "paste" the following code (from that web
site).

Here is the code you paste:

'This code was originally written by Keri Hardwick.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code Courtesy of
'Keri Hardwick
'
Function nnz(testvalue As Variant) As Variant
'Not Numeric return zero
If Not (IsNumeric(testvalue)) Then
nnz = 0
Else
nnz = testvalue
End If
End Function


Now once you put the above code in the module...click on the save button.
You can use the "default" module name (ie: module1, module2..etc..these
number just like forms, or queries when you don't give them a name).

after you save, then close the code editor (click on the 'x' in the upright
right hand corner).

At this point in time, you are now able to use the nnz function anywhere.

So, in your case, change you expression in the "main" code for from

=nzz( you existing expression in the main form goes here )

All that the nzz function does is check if nothing is return..and thus
changes it to a zero...


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada

http://www.members.shaw.ca/AlbertKallal



 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to send email via website account [email protected] General Discussion 5 December 2nd, 2005 11:37 PM
Multiple Users of One Website Linda General Discussion 5 March 9th, 2005 12:21 AM
Taking numbers off a website and importing them into Excel? Possible? DrSues02 General Discussion 1 October 19th, 2004 02:01 PM
Taking numbers off a website and importing them into Excel? Possible? DrSues02 General Discussion 1 October 19th, 2004 08:41 AM


All times are GMT +1. The time now is 05:11 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.