By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,679 Members | 2,763 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,679 IT Pros & Developers. It's quick & easy.

getting error when calculating total using unbound text field in subform

P: 2
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([Amount])
In my main form i have one more unbound text field named txt_Sub_Total
with the controlsource value as.
controlSource : =[Purchase_Register_Details].[Form]![txt_Total_Amount]
but i am getting error, i am not able to make out where is the mistake.
Can anybody help me in this regard?

Thanks and Regards
Sumit
Sep 10 '09 #1

✓ answered by Stewart Ross

Hi. We have an Insight article which provides a full reference on Referring to Items on a Subform.

There is, however, no obvious problem with the subform reference you have listed. You should check that the name of the subform you quote is indeed the name of the object as it is listed in the properties tab for the subform within the main form. If it is, you will need to be systematic in debugging your form - you could start by using the immediate window in the VB editor with the form open (not in design mode) to test values of controls and see what is and is not working as it should.

It would also help us if you would tell us what error you are getting - saves us guessing!

-Stewart

Share this Question
Share on Google+
4 Replies


Expert Mod 2.5K+
P: 2,545
Hi. We have an Insight article which provides a full reference on Referring to Items on a Subform.

There is, however, no obvious problem with the subform reference you have listed. You should check that the name of the subform you quote is indeed the name of the object as it is listed in the properties tab for the subform within the main form. If it is, you will need to be systematic in debugging your form - you could start by using the immediate window in the VB editor with the form open (not in design mode) to test values of controls and see what is and is not working as it should.

It would also help us if you would tell us what error you are getting - saves us guessing!

-Stewart
Sep 10 '09 #2

NeoPa
Expert Mod 15k+
P: 31,276
Check out Referring to Items on a Sub-Form.

It describes the difference between a SubForm control and a form used as a subform. The latter would typically be included within the former.

PS. Maybe I should have refreshed before posting :(
Well done again Stewart. An exemplary answer.
Sep 10 '09 #3

P: 2
Thanks Stewart ,
I tried checking the value of controls in immediate window and i got the follwing error
RunTime Error 3270
Property Not Found.
I could not make out why its giving me this error?
Do i need to set any references or something like that?
I really don't know. I am new to Access programming.
Please Help me

Regards Sumit
Sep 11 '09 #4

Expert Mod 2.5K+
P: 2,545
This is not a problem with references. If you are using the immediate window you will need to specify the full form title using the Forms keyword and qualifying it by name (as the simplest method). To show how it is done, here is how you use the VB immediate window to show the value of a subform control in a form open in form view.

The control is named [Total Compliments]

on a subform named frmOverallTotals

within a mainform named frmMainMenu (from one of my apps):

Expand|Select|Wrap|Line Numbers
  1. ? Forms("frmMainMenu")![frmOverallTotals].Form![Total Compliments]
  2.  4 
The value 4 is listed below the question mark, which is the value of the form control mentioned.

The use of the full forms("somename") syntax is covered in the article which NeoPa and I recommended to you.

-Stewart
Sep 11 '09 #5

Post your reply

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