Log in

View Full Version : How to concatenate values from controls to a single field in a table



Slicemahn
11-04-2007, 10:59 PM
Hi Everyone,

I am trying to put this form together in which there must be a naming convention for the campaign name in my campaign table. I have three combo boxes: (i) Strategy in which there could be things such as DM, EM or OL (ii) Month (iii) Year (4 digits). There is also a text box in which the user can input a descriptive name for the campaign such Ottawa Gazette Fall insert etc.
The controls have mentioned are not bound to anything,but another text box which is bound to the table holds the expression:

cboTactic&("-")&cboMonth&Right([cboYear],2)&txtbox

You would think that this would return the concatenated value that I want but the only thing that shows is "-" or hyphen. Am I approaching this the right way by placing the expression in the On Current event of my form?

Many thanks in advance for all your thoughts and suggestions.

OBP
11-05-2007, 07:13 AM
Sliceman, you have chosen the wrong event to put your code in ( which works by the way), it should be in the cboYear after update event.
It could be in all three cbos in case someone goes back and changes a value, but you will have to look at Null checks for them.

DarkSprout
11-05-2007, 08:14 AM
I've Added _AfterUpdate to the unbound Combo- and Text boxes, and tweaked some code - it should now do the job!

Enjoy,
=DarkSprout=