On my subform I have a field in the footer that totals the value of a
field. On the main form I have referenced this field. I'm using this
field in a calculation on my main form. The problem occurs when there
are no records in the subform. The field on the main form that
references the subform total field returns #Error. How can I make
this field show the total when there are records and 0 when there are
no records???
Thank you,
Chris Vettese 9 3154
A stab in the dark here, but try NZ function.
i.e.
=nz(forms![PARENTFORMNAME]![chldFormObjectN ame]![FieldReferenced],0)
Don't know if it will work, but give it a shot.
Regards,
Fraser. ch**********@ya hoo.com (chris vettese) wrote: On my subform I have a field in the footer that totals the value of a field. On the main form I have referenced this field. I'm using this field in a calculation on my main form. The problem occurs when there are no records in the subform. The field on the main form that references the subform total field returns #Error. How can I make this field show the total when there are records and 0 when there are no records???
Thank you, Chris Vettese
Thanks for the response, unfortunatley it did not work. Any other ideas?
Regards,
Chris
"4Fraza" <fr***@clear.ne t.nz> wrote in message news:<40******* *@clear.net.nz> ... A stab in the dark here, but try NZ function.
i.e. =nz(forms![PARENTFORMNAME]![chldFormObjectN ame]![FieldReferenced],0)
Don't know if it will work, but give it a shot.
Regards,
Fraser.
ch**********@ya hoo.com (chris vettese) wrote:On my subform I have a field in the footer that totals the value of a field. On the main form I have referenced this field. I'm using this field in a calculation on my main form. The problem occurs when there are no records in the subform. The field on the main form that references the subform total field returns #Error. How can I make this field show the total when there are records and 0 when there are no records???
Thank you, Chris Vettese
On 30 Jan 2004 11:59:42 -0800, chris vettese wrote: =nz(forms![PARENTFORMNAME]![chldFormObjectN ame]![FieldReferenced],0)
I believe the refference to the field may be incorrect. Try
=nz(forms![PARENTFORMNAME]![chldFormObjectN ame].Form![FieldReferenced],0)
--
Mike Storr
veraccess.com
This did not work either, is there a VB solution?
Chris
Mike Storr <st******@sympa tico.ca> wrote in message news:<9k******* *************** *******@40tude. net>... On 30 Jan 2004 11:59:42 -0800, chris vettese wrote:
=nz(forms![PARENTFORMNAME]![chldFormObjectN ame]![FieldReferenced],0)
I believe the refference to the field may be incorrect. Try
=nz(forms![PARENTFORMNAME]![chldFormObjectN ame].Form![FieldReferenced],0)
chris vettese wrote: =nz(forms![PARENTFORMNAME]![chldFormObjectN ame]![FieldReferenced],0)
=nz(forms![PARENTFORMNAME]![chldFormObjectN ame].Form![FieldReferenced],0)
I understand why Nz doesn't help you out--if there are no records, there
is no subform control present to refer to. No amount of Null checking
will help.
Is it possible to lift the calculation out of the subform? Into the main
form control, that is.
--
Bas Cost Budde http://www.heuveltop.nl/BasCB
I can not bring the calculation to the main form. There has to be a
way to do this. What about HasData? Is there a way I can use this
in a form?
Chris
Bas Cost Budde <ba*@heuveltop. org> wrote in message news:<bv******* ***@news2.solco n.nl>... chris vettese wrote:
=nz(forms![PARENTFORMNAME]![chldFormObjectN ame]![FieldReferenced],0)=nz(forms![PARENTFORMNAME]![chldFormObjectN ame].Form![FieldReferenced],0)
I understand why Nz doesn't help you out--if there are no records, there is no subform control present to refer to. No amount of Null checking will help.
Is it possible to lift the calculation out of the subform? Into the main form control, that is.
On 4 Feb 2004 13:23:25 -0800, ch**********@ya hoo.com (chris vettese) wrote: I can not bring the calculation to the main form. There has to be a way to do this. What about HasData? Is there a way I can use this in a form?
Chris
Bas Cost Budde <ba*@heuveltop. org> wrote in message news:<bv******* ***@news2.solco n.nl>... chris vettese wrote:
>>>=nz(forms![PARENTFORMNAME]![chldFormObjectN ame]![FieldReferenced],0)
>>=nz(forms![PARENTFORMNAME]![chldFormObjectN ame].Form![FieldReferenced],0)
I understand why Nz doesn't help you out--if there are no records, there is no subform control present to refer to. No amount of Null checking will help.
Is it possible to lift the calculation out of the subform? Into the main form control, that is.
Create a custom function that first checks for the existance of records in the subform. If records exist return the total else return 0.
Something like -
Function fGetTotal()
With Me.frmNameOfSub form.Form.Recor dsetClone
IF .RecordCount<>0 Then
fGetTotal=Me.fr mNameOfSubform. Form!NameOfTota lsControl
Else
fGetTotal=0
End IF
End With
Exit Function
Set the ControlSource of the control on your main form to =fGetTotal()
Wayne Gillespie
Gosford NSW Australia
chris vettese wrote: I can not bring the calculation to the main form. There has to be a way to do this. What about HasData? Is there a way I can use this in a form?
No, it applies only during Print or Preview.
Maybe you can formulate the condition where there will be no records in
the subform, and wrap the formula on the main form control in such a test?
What is your goal? Maybe it helps if I can think myself through the
structure.
--
Bas Cost Budde http://www.heuveltop.nl/BasCB
THANK YOU very much for everyone who posted!!!
Wayne's post provided me with the solution I needed.
Again, I appreciate everyone's time and effort.
Best Regards,
Chris vettese
Wayne Gillespie <be*****@NObest fitsoftwareSPAM .com.au> wrote in message news:<e1******* *************** **********@4ax. com>... On 4 Feb 2004 13:23:25 -0800, ch**********@ya hoo.com (chris vettese) wrote:
I can not bring the calculation to the main form. There has to be a way to do this. What about HasData? Is there a way I can use this in a form?
Chris
Bas Cost Budde <ba*@heuveltop. org> wrote in message news:<bv******* ***@news2.solco n.nl>... chris vettese wrote:
>>>=nz(forms![PARENTFORMNAME]![chldFormObjectN ame]![FieldReferenced],0)>=nz(forms![PARENTFORMNAME]![chldFormObjectN ame].Form![FieldReferenced],0)
I understand why Nz doesn't help you out--if there are no records, there is no subform control present to refer to. No amount of Null checking will help.
Is it possible to lift the calculation out of the subform? Into the main form control, that is.
Create a custom function that first checks for the existance of records in the subform. If records exist return the total else return 0.
Something like -
Function fGetTotal()
With Me.frmNameOfSub form.Form.Recor dsetClone IF .RecordCount<>0 Then fGetTotal=Me.fr mNameOfSubform. Form!NameOfTota lsControl Else fGetTotal=0 End IF End With
Exit Function
Set the ControlSource of the control on your main form to =fGetTotal()
Wayne Gillespie Gosford NSW Australia This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lyn |
last post by:
Hi,
I am working on a genealogy form. The only table (so far) lists everybody
in the family, one record per person. Each record has an autonum ID.
The parent form (frmMainForm) displays the data in each record, which
includes the ID of the father and the mother (who also have records in the
table). One record per form.
I have a Tab Control in the form, and in one of the tabs I have a subform
(sfmSiblings) in which I wish to list...
|
by: CSDunn |
last post by:
Hello,
In an Access 2003 Project, I have a main form called
‘frmRCAddendumInputMain' that contains a subform called
‘frmRCAddendumInputSub'. The main form opens upon clicking a button
from another form called ‘frmRCMain'. In frmRCAddendumInputMain, there
is an unbound text box called ‘PassPermnum' that gets its value from a
field called ‘Permnum' on frmRCMain. The calculation in ‘PassPermnum'
is as follows;
|
by: Dave Boyd |
last post by:
Hi,
I have two very similar forms each with a subform. The main form gets
a few fields from the user and passes this back to a query that the
subform is bound to. The requery is done when the user enters the
last qualifying field on the main form.
In one case this works fine, the subform shows the data the user wants
to update -- which means showing all the data put in previously (ie
showing this via the requery and the continuous...
|
by: tdmailbox |
last post by:
I have a form with a child form. In the child form there is a list of
names that can grow quite large. On the parent form I want to display
the first name from the child form. I set up a test box that is
populated with the code
=subfrm_media_review_sec_party.Form!first_name & " " &
subfrm_media_review_sec_party.Form!last_name
It works except that when I flip through the names it populates the
parent form with the name of what ever...
|
by: gavo |
last post by:
Hello everyone! Using A2K
i have a form(a) with a subform(b) and within the subform there is a
continuous subform(c).
in the subform (b) there is a command button used to call a public function
| |
by: Spencer Lee |
last post by:
Hi all,
I really need some helps.
I created a main form("category"), which contains a subform1, "Part".
Inside this subform also has contains a subform2, "Inventory".
The second level of subform, "Inventory" contains the field of quantity
in and out, and therefore I create a text box to do the calculation for
UnitOnHand. One textbox is also prepared in subform1, "Part", to get the
|
by: Ecohouse |
last post by:
I have a main form with two subforms. The first subform has the child
link to the main form identity key.
subform1 - Master Field: SK
Child Field: TrainingMasterSK
The second subform has a master-child link to the first subform.
subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK
Child Field: TrainingModuleTopicSK
|
by: meLady |
last post by:
Hello,
I have a form called feedback with a subform called feedback Options.
I did some counting calculation in master form "feedback" at the bottom page.
the calculation is about count the number of yes, no and null that are in the feedback Options.
the problem is that when navigate to a new form the calculation of the previous form is still in and I tried many times to find a solution but I couldn't ...
|
by: Bob Alston |
last post by:
I have a system where many subforms are used. Often the size of the
subform had to be larger than could be displayed without scrolling.
I set the height of the subform to the typical height appropriate for
the typical screen resolution they were using.
Now some users have decided to use higher screen resolutions, up to
1280/1024. When they maximize the form, that of course works but the
size of the main form control containing the...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |