transfer value from combox to textbox

purejoker

New member
Local time
Today, 14:25
Joined
Nov 21, 2005
Messages
6
hi, umm im tring to copy values from a combobox into a textbox so that multilpe values can be saved on the databse.

the textbox it linked to a table, and the combobox uses sql quries 2 get data from a table... i have a command button which then inserts the vaule from the combobox to the textbox.

in the commmand button the vba code used is:
textbox.value = combobox.value

but this only insert one value to the text box i want multiple value one after the other. it just keeps replace the value which is already in the textbox i want it to add on 2 the value in the textbox...

can any1 help me out?
thank you 4 ur time!
purejoker!
 
The columns in the combo box are numbered from left to right starting with 0 (zero). Therefore the third column from the left would in fact be column 2.

If you wished to copy the data from columns 2 and 3 (lets say) the code would be:
[fieldname1] = ([Combo#],2)
[fieldname2] = ([Combo#],3)
 
sry m8 i forgot 2 tell you is only 1 column in the combobox, i just want it 2 add items from the list to the textbox, 1 after the other. so you wod select 1 item from the combobox n itt will add to the textbox n then select another item from the saem combo n it will add to the same textbox.

thnk you anyway
 
PMFJI but just change you code to:
Me.TextBox = Me.TextBox & Me.ComboBox
Note: .Value is the default property so it is not necessary to specify it.
 
m8 sry but wot wod i replace me with and textbox with im confused!
thank you 4 ur help
purejoker!
 

Users who are viewing this thread

Back
Top Bottom