After Update multiple TextBox's to one textbox that's not being recorded in the Query

Plukey

Board Regular
Joined
Apr 19, 2019
Messages
138
Office Version
  1. 2016
Platform
  1. Windows
VBA Code:
Private Sub Text9_AfterUpdate()
    Dim Output As String
    
    Output = Text9
    Text9 = Output
   
    Forms![Data Entry Form]![Master Tab Subform]!Text9 = Forms![Data Entry Form]![Master Tab Subform]!Text9 & vbCrLf & Output
    
   
End Sub

Ive placed this code in each subform textbox. There's six sub forms with a comment Textbox's that user enters a short comment text & after update it records each to a main summary box. Problem is the code works but when I check the query doesn't it doesnt retain the comments. Ive notice after update it records and paste on one space down inside the text box. And when i manually enter in the summary box it starts on Top left and when i check the query the comments are there.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
So i think its due to the vbCrlf, when it activates its posting on the line below which isn't getting recorded. Is there a way to make it start on the fist line and then append each other statement when entered in the other sub form comment boxes?
 
Upvote 0
hard to follow, but I think you've got a sort of circular reference going on there. After a control updates, it's value is whatever is visible in the control. Let's say that Text9 contains 55 after the update. So your code is saying
Output = 55 (Output = Text9)
55 = 55 . . . . .(Text9 = Output)
55 = 55 & vbCrLf & 55
Forms![Data Entry Form]![Master Tab Subform]!Text9
= Forms![Data Entry Form]![Master Tab Subform]!Text9 & vbCrLf & Output

I can't tell if the summary control is Text9 or if it's on the main or subform. If Text9 and its code is on the subform you can just use Me.Text9.
Also, if you are expecting a table record to be modified this way and multiple forms/controls are involved it's important to realize that the record that will be updated is the one that is the active record.

Maybe some pics of before and desired results would help clear things up if that doesn't help.
 
Upvote 0
Solution
hard to follow, but I think you've got a sort of circular reference going on there. After a control updates, it's value is whatever is visible in the control. Let's say that Text9 contains 55 after the update. So your code is saying
Output = 55 (Output = Text9)
55 = 55 . . . . .(Text9 = Output)
55 = 55 & vbCrLf & 55
Forms![Data Entry Form]![Master Tab Subform]!Text9
= Forms![Data Entry Form]![Master Tab Subform]!Text9 & vbCrLf & Output

I can't tell if the summary control is Text9 or if it's on the main or subform. If Text9 and its code is on the subform you can just use Me.Text9.
Also, if you are expecting a table record to be modified this way and multiple forms/controls are involved it's important to realize that the record that will be updated is the one that is the active record.

Maybe some pics of before and desired results would help clear things up if that doesn't help.
Yea, sorry.. i can see the confusion. The person that built the Db named all the text boxes in each sub form Text9 which had me confused as well. I dropped the F in VBCrlf and after update the value starts on the tp left of the summary text box and gets recorded in the table.
 
Upvote 0
Glad if I helped in some small way although I don't quite see how vbCrL would work if that's what you're saying. Thanks for the recognition, although it seems like you provided your own solution.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,193
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top