My Assistant
![]()
Custom Search
|
![]() ![]() |
![]() |
![]() Post#1 | |
![]() UtterAccess VIP Posts: 9,382 Joined: 10-February 04 From: South Charleston, WV ![]() | Does anybody know the correct syntax for referencing a textbox on a subform in a main form? The textbox in question is in the footer section of the subform. I tried Me.Subformname.Form.Controlname but that didn't work. The attached db is the one where this came up in another thread. Form2 contains 2 subforms, 1 for debits. 1 for credits. We are trying to calculate the balance of total debits minus total credits. I'm using Dsum's but I'd rather reference the subforms. Attached File(s) -------------------- |
![]() Post#2 | |
![]() Posts: 962 Joined: 26-March 08 From: London, UK ![]() | Hi Robert, Try: CODE Me.[Receipts Form].Form.txtDrSum And: CODE Me.[Payment Form].Form.txtCrSum Where [Receipt Form] and [Payment Form] are the Sub Control names. HTH... Hairy. This post has been edited by HairyBob: Dec 7 2017, 04:15 AM |
![]() Post#3 | |
![]() UtterAccess VIP Posts: 9,382 Joined: 10-February 04 From: South Charleston, WV ![]() | As I stated in my post, I've already tried that. If you've done it this way and it works, then please post it. -------------------- |
![]() Post#4 | |
UtterAccess VIP Posts: 7,322 Joined: 24-May 10 From: Downeast Maine ![]() | If referencing it by using an expression in the text box Control Source the Me syntax won't work since that is VBA only. This worked for me as Control Source expressions: =[Forms]![Form2]![Receipts Form].[Form]![txtDrSum] =[Forms]![Form2]![Payment Form].[Form]![txtCrSum] If those text boxes are named txtDrTotal and txtCrTotal you can have another text box to sum those: =[txtDrTotal] + [txtCrTotal] I assume you are not trying to use VBA, since I don't see any code in the sample database. If you are trying to use VBA, more information is needed. |
![]() Post#5 | |
![]() UtterAccess VIP Posts: 588 Joined: 18-February 09 From: North Augusta, SC ![]() | You can use this: Me.FormFooter.Controls("txtcrsum") Or the full reference to the form: Forms!YourForm.FormFooter.Controls("txtcrsum") -------------------- Scott McDaniel | Infotrakker Software | Microsoft MVP 2009 - Current |
![]() Post#6 | |
![]() UtterAccess VIP Posts: 12,576 Joined: 6-June 05 From: Dunbar,Scotland ![]() | -------------------- Hope this helps? Mike Get happiness out of your work or you may never know what happiness is. |
![]() Post#7 | |
UtterAccess VIP Posts: 7,322 Joined: 24-May 10 From: Downeast Maine ![]() | Yes, that is the same as my suggestion, except I mistakenly showed addition rather than subtraction with credits and debits. |
![]() Post#8 | |
![]() UtterAccess VIP Posts: 9,382 Joined: 10-February 04 From: South Charleston, WV ![]() | Thanks to all who posted. The solution proposed by Bruce works. (I have used this in the past, I just couldn't remember it.) Thanks to all who posted. -------------------- |
![]() Post#9 | |
![]() Posts: 962 Joined: 26-March 08 From: London, UK ![]() | Hi Robert, Looks like Mike & Bruce beat me to it; however, here's what I did to test it (see attachment). Apologies for not posting the attachment in the first place. Regards, Hairy. Attached File(s) |
![]() Post#10 | |
UtterAccess VIP Posts: 7,322 Joined: 24-May 10 From: Downeast Maine ![]() | Glad to hear it. Good luck with the project. |
![]() Post#11 | |
![]() UtterAccess VIP Posts: 9,382 Joined: 10-February 04 From: South Charleston, WV ![]() | Thanks, Hairy. -------------------- |
![]()
Custom Search
|
![]() | Search Top Lo-Fi | 22nd April 2018 - 07:37 AM |