473,799 Members | 2,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Total problem in subform

ken
I have a formA and subformB
subformB is a continous form
with a txtTotal in form footer
=Sum([Total])
This works fine as long as there are
records in form
but if form is null I get Error
I would like to get arround this as I
Have a label to be Visible only
if txtTotal>= 45000
The way it is now label shows up visible
on form when it has no records
thank you for any suggestions

Feb 2 '06 #1
16 2464
Ken,

Try making the box visible based on the following

If Not IsNull(Me.txtTo tal) and Me.txtTotal>=45 000 Then

Me.txtTotal.Vis ible = True

End If

Linda

"ken" <ke******@yahoo .com> wrote in message
news:11******** *************@g 44g2000cwa.goog legroups.com...
I have a formA and subformB
subformB is a continous form
with a txtTotal in form footer
=Sum([Total])
This works fine as long as there are
records in form
but if form is null I get Error
I would like to get arround this as I
Have a label to be Visible only
if txtTotal>= 45000
The way it is now label shows up visible
on form when it has no records
thank you for any suggestions

Feb 2 '06 #2
ken
tried it and still not working

Feb 3 '06 #3

Private Sub Form_Current()
Me!txtTotal.vis ible = Nz(Me!txtTotal, 0) >=45000
End Sub
Thick Quinker - I just never learn.

*** Sent via Developersdex http://www.developersdex.com ***
Feb 3 '06 #4
Please ignore my response.

Private Sub Form_Current()
Me!txtTotal.vis ible = Nz(Me!txtTotal, 0) >=45000
End Sub

It was intended for a different problem altogether. I don't know how it
ended up here.

Thick Quinker - I just never learn.

*** Sent via Developersdex http://www.developersdex.com ***
Feb 3 '06 #5
I have a formA and subformB
subformB is a continous form with a txtTotal in form footer
=Sum([Total])
This works fine as long as there are records in form
but if form is null I get Error I would like to get around this as I
have a label to be Visible only if txtTotal>= 45000
The way it is now label shows up visible on form when it has no records
thank you for any suggestions

I know of no event which occurs when subform totals have been
calculated. There is invariably an indeterminate delay before one can
use a subform total in further expressions which leads to unpredictable
results. One can use the main form's timer event to do such work but
I've found a better approach is to compute the total in the main form's
current event for this purpose.

Assumptions:

1) The column being summed is named Item
2) The label you want to show or hide is on the subform
3) The linking index in both forms is named IndexID
4) The RecordSource of the subform is named SubTable

Use the following in your main form, formA:

Private Sub Form_Current()
Me!subformB!lbl Label.Visible = Nz(DSum("Nz(Sub Table!Item, 0)",
"SubTable", "IndexID=" & Me![IndexID])) >= 45000
End Sub

Sorry about the earlier confusion. I've really got to take more time to
ponder the question before offering a solution.

Thick Quinker - I just never learn.

*** Sent via Developersdex http://www.developersdex.com ***
Feb 3 '06 #6
ken
Thank you for the response and advice
The only question i have is the formA and suformB are linked
with DateId as this is a schedule form
and formA is just dates and subformB is details for deliverys on
particular day
Thanks
Ken
steve.minnaar wrote:
I have a formA and subformB
subformB is a continous form with a txtTotal in form footer
=Sum([Total])
This works fine as long as there are records in form
but if form is null I get Error I would like to get around this as I
have a label to be Visible only if txtTotal>= 45000
The way it is now label shows up visible on form when it has no records
thank you for any suggestions

I know of no event which occurs when subform totals have been
calculated. There is invariably an indeterminate delay before one can
use a subform total in further expressions which leads to unpredictable
results. One can use the main form's timer event to do such work but
I've found a better approach is to compute the total in the main form's
current event for this purpose.

Assumptions:

1) The column being summed is named Item
2) The label you want to show or hide is on the subform
3) The linking index in both forms is named IndexID
4) The RecordSource of the subform is named SubTable

Use the following in your main form, formA:

Private Sub Form_Current()
Me!subformB!lbl Label.Visible = Nz(DSum("Nz(Sub Table!Item, 0)",
"SubTable", "IndexID=" & Me![IndexID])) >= 45000
End Sub

Sorry about the earlier confusion. I've really got to take more time to
ponder the question before offering a solution.

Thick Quinker - I just never learn.

*** Sent via Developersdex http://www.developersdex.com ***


Feb 5 '06 #7
Ken,

In the example (note that I'm now using DateID):

Private Sub Form_Current()
Me!subformB!lbl Label.Visible = Nz(DSum("Nz(Sub Table!Item, 0)",
"SubTable", "DateId=" & Me![DateId])) >= 45000
End Sub

"DateId=" & Me![DateId] is the criterion to identify the records which
are displayed in the subform.

Just as Access would use the "Link Child Fields" and "Link Master
Fields" properties to display a subset of records in the subform, you
need to mimic this in the DSum expression used in your main form.

By the way, I'm new to groups and might be unwittingly breaking a few
cardinal rules here. If I do please let me know.
In the extraction from your previous post I manually added the "> "
before each line. Is there an automatic way to do this?

Ken wrote:
Thank you for the response and advice
The only question i have is the formA and suformB are
linked with DateId as this is a schedule form
and formA is just dates and subformB is details for
deliverys on particular day
Thanks
Ken

*** Sent via Developersdex http://www.developersdex.com ***
Feb 5 '06 #8
ken
I ran the code just like stated above but
label is still visible even of total over 45000
any suggestions
Ken

Feb 10 '06 #9
On 1 Feb 2006 16:58:34 -0800, "ken" <ke******@yahoo .com> wrote:
I have a formA and subformB
subformB is a continous form
with a txtTotal in form footer
=Sum([Total])
This works fine as long as there are
records in form
but if form is null I get Error
I would like to get arround this as I
Have a label to be Visible only
if txtTotal>= 45000
The way it is now label shows up visible
on form when it has no records
thank you for any suggestions


You do not needtxtTotal in the subform.
Put something like this in the current event of formA.

Sub Form_Current()

Me.MyLable.Visi ble=Me!SubformB !Form.Recordset Clone.RecordCou nt >0 AND _
DSum("[Total]", Me!SubformB!For m.RecordSource) >=45000

End Sub

Wayne Gillespie
Gosford NSW Australia
Feb 10 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1954
by: Ellen Manning | last post by:
I've got an A2K form with a subform based on a query. This query has a checkbox and an amount field and returns records if checkbox is checked. I Dsum the amount field and display on the main form. If the user unchecks the box, I want the corresponding amount subtracted from the total. If they recheck the box, the amount is to be added. I want all records to appear on the subform even after unchecking them. This works fine...except......
2
17007
by: dath | last post by:
Hi, Not really a programmer here, but have been forced into the role. I was asked to develop a basic time sheet for employees to enter time. I developed the Table without a problem. I then developed a query to limit the records displayed based upon an employee last name and a month. Once again no problem. I then stareted developing the form based on the query. The form has a subform using data sheet display. Form prompts user for...
1
1360
by: Rog | last post by:
Hi, I'm trying to calculate the food allowance for the household employees in the diplomatic mission where I work. For each employee/month I have a subform with a maximum of 3 records for Breakfast, Lunch and Dinner. For each type of meal, the subform has radio buttons for days D1 to D31 (hiding D29 to D31 where appropriate), NumberOfMeals (=-++...+), MealValue, and Total (=*). So far so good. But now I want
33
8247
by: potassium flower | last post by:
I am trying to create a food order system for a restaurant. I have tried using both the DSum and Sum functions to calculate the total cost of an order. The total cost is a textbox on the form tblOrder (and a field in tblOrder) and the list of meals along with their costs are in the tblOrderDetail Subform (the columns in this form come fromt two tables - tblOrderDetails and tblItems). I have been putting the DSum / Sum in the control...
3
2413
by: virtualgreek | last post by:
Dear all, I have a scenario that is driving me nuts. (MS Access 2003) I have a form/subform (Continuous form) where it gets its data from tables Order and Order_Details. In the footer section of the subform I have a hidden textbox named txtOrder_Total_Amount which displays the total of the whole order. On the main form I have a bound contol from the Order table, namely Order.Order_Total_Amount_Euro On the subform I have fields such...
4
2200
by: drago | last post by:
Hi guys, I will be quick this time... Just want to know how we can calculate generic values in the same column. I am using invoice form with a services subform . I have a column of 'total' in subform and I want to add all values of that column to get the total cost on main invoice form. The 'total' column contains service cost of different clients. Some clients have 1 service i.e 1 total which is the total cost but most clients have more then 1...
4
1856
by: Scotter | last post by:
Hello. I'm having problems understanding how to calculate a total on my main form based on the items in my subform. I've tried runing update querys and thats not working, and Ive tried just calculating within the form, and thats not working correctly either. My main form is called Form1, and my subform is testquery2_subform. Whats happening is, the customers information(first name, last name, etc...), and the delivery/pickup dates, is on...
3
1776
by: ezra | last post by:
I am trying to create an invoice program that will automatically generate an invoice based on charges entered in a subform. Sounds easy enough! I have created my Total field on subform as unbound and called it Ttl. I have used this code to tally the total of all charges =Sum(). This works fine. I have then put a GrandTotal filed on my Customer info form and asigned it this value =frmCharges.Form!Ttl. Again, the field total looks fine as long...
4
4036
by: sumit kale | last post by:
Hi, Can somebody help me resolve my problem ? I am getting error when calculating total using unbound textfiled in subform. I have a main form called purchase_register_master and a subform called purchase_register_details, In sub form i have a unbound textfield called txt_Total_Amount where in i am calculating total amount for different items purchased by giving following code in control source. ContolSource: =Sum() In my main form i...
0
9540
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10250
jinu1996
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...
0
10026
tracyyun
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...
1
7564
isladogs
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...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
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...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
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
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.