Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatenate fields on form and write back to table

Status
Not open for further replies.
Mar 15, 2016
14
US
Hello,

I seem to be beating my head against the wall on something I should know and something I know I've done before. I have a form that takes text box A and concatenates text box B to create text box C. I have the correct concatenation string showing up on the form so i know it's putting together the data right. Now, how do I take that information in the text box C and write back to the table? I currently have the record source as a query that just looks at my master table.

Would I have to add these new records to a temp table and use an update query to write these back to the master table? Isn't there an easier way?

 
Why do you want to store a value that can be calculated on the fly? This isn't typically good practice.

However, you can set the control source of text box C to the field in your table and use a little code in the after update events of txtA and txtB to set the value:

Code:
Me.txtC = Me.txtA & Me.txtB


Duane
Hook'D on Access
MS Access MVP
 
Actually... now that you've talked it out, I'm not sure why i done it that way either. What I ended up doing was taking the data and storing it in a temp table and then append all of the records (including the concatenated field) to a master table. I know that is highly inefficient but it worked in a pinch.

I found out later than the DB requester is just dumping the data from Access to Excel anyways so I could have done the concatenation on the fly. Thanks for the tip though. It would have been much easier to do it on the fly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top