Unanswered: Combining multiple field values into one field
I've a data entry form that includes fields 'Surname', 'Given Name', 'Middle Initial', and 'Differentiator'.
I need to capture the values the user enters into these fields, and populate another hidden text field (on the same frickin form) with a string that combines all four values, ie "SnameGnameMInitDiff". This string then needs to go back into the same underlying table as all the rest of the entered data, and (hopefully) I can use it on later 'edit' forms for finding records, and for generating reports etc.
I don't want to use dlookup for the new 'string' field seeing as I need to get it's value back into the table.
Any ideas on how I do this?
Save your record after that to update the record in the table. Note that anything with the prefix 'txt' refers to a control on your form, and not necessarily a field in your table, so you need to name your text boxes on your form accordingly.
Cheers for the reply, bcass.
I'm a noob to Access/VB, so please bear with me...!
2 dumb questions.....
1) You say 'In your code, use....' - Where do I put the code? If the control source for the field relates to it's corresponding field in the table, I can't put the code there, so do I put it on an event? ie - 'Got Focus' for the new 'string' field?
b) 'Save your record after that to update the record in the table' - Does this mean this particular 'string' field on the record isn't populated untill I run some sort of query AFTER the record is saved with the rest of its data?
You could create a button (call it a Save button) that the user should press when they want to perform the action you outline, which also saves the record (with the updated data in your hidden field). Create a button on your form, and assign the following code to its OnClick Event: