Text Boxes / Updating Table

dbnewbie

Registered User.
Local time
Yesterday, 22:05
Joined
Jun 10, 2005
Messages
15
Hi,

I am trying to take text from two different text boxes on a form and place into another text box on the form. I want it to also update the table with this new text.

Example: fname, lname, fullname are text boxes on a form. when user enters fname and lname, I want the two strings/text to be added together and placed in fullname while also updating the table with the fullname text.

Any ideas?

Thanks,
dbnewbie
 
This can be done on the form this way:

create an unbound text box and set below as the control source

=([lname] & ", " & [fname]) will return Doe, Jane

or

=([fname]&" "&[lname]) will return: Jane Doe


Are you putting the name in your table once or twice?
 
Last edited:
Thanks for the quick response.

I actually have that part already. I'm trying to figure out how to put the new string (i.e. fullname) into a field in a table. I'm taking these two strings from two different tabels and placing them into another table as one.

Since the control source is the formula (i.e. =([lname] & ", " & [fname])), it isn't placing this new value into the table (which is what I want).

I hope I'm making sense...

Thanks,
dbnewbie
 
The question has to be why you would want to do this, it's totally unnecessary
 
And my question would be, why not? Is it impossible to do in Access?

Otherwise, I can just run an update query to fill in this field or have a query to get whatever information I'm needing...
 
The reason I asked: Are you putting the name in your table once or twice?

Is like Rich said unneccesary and not recommended to store data twice in your database.

You can however do what you want by adding a field in your table.

On your form, hide an unbound text box with fname and lname combined.

Add your new field (textbox) to your form. On AfterUpdate on the "lname" put

Me.newfield = Me.hiddentextbox

I attached what I mean. There maybe a better way but this gets it done.
 

Attachments

As long as you have the text box holding the results bound to a field in your table the code you used is fine.

Ie: txtFullName bound to tblNames FullName filed. 3 text boxes on the form named txtFirst, txtLast, txtFullName

txtFullName = txtFirst & " " & txtLast for John Doe
txtFullName = txtLast & ", " & txtFirst for Doe, John

Pick the way you want to store your record or make your own.
 
dbnewbie said:
And my question would be, why not? Is it impossible to do in Access?

Otherwise, I can just run an update query to fill in this field or have a query to get whatever information I'm needing...

The correct way to extract data from tables is to use a query or a simple calculated control, what if you store this value and then somebody realises they've spelt either the first or last name incorrectly, the calculated value you've stored is suddenly incorrect.
 
Thanks guys!

I went with RichB's idea...very helpful, thanks :)
 

Users who are viewing this thread

Back
Top Bottom