Row Source Adding

A

arthursdomain

I was wondering if it was possible to add new values to the 'Row
Source' by having a unbound box with like an add button that would then
append to the Row Source of X combo box.

ie.
Product Name [ []] (combo box - which will drop down a name
of the product.

productnamecombobox:row source = "pencil";"pen";"ruler"

-------

Product Name [ []] [ADD]
or
Product Name [ []] [NEW] (new button will pop up another
form window which will then have a field which will be like:

New Product Name [ ] [ADD] (which will then add another
value to the row source of the Productnamecombobox. Pressing add will
also close the form)

but I guess my main question is , is it possible to add a value to the
row source or should i use a table?
TIA

Z
 
G

Guest

Normally your row source is a table - either directly or through a query.
Take a look and see what the source is. If it is a query then look at the
row source of the query. Then add to the table.
 
A

arthursdomain

Well on this problem, i use the combox wizard and then i choose the
option to insert my own values ( i dont think it creates a table , none
that i can see anyway ), so once the values are in when i click on the
properties and then look at Row Source: (i see) "pencil";"pen";"eraser"
-- and if i want to add on , i just click at the end of the row source
and add a ( ;"paper";"folder" ) and then it shows up in the combo box
drop down list.

I was wondering if there was a way where i get a unbound text box with
an add button to append to the row source, without doing it manually
how im normally doing it.

Z
 
D

Douglas J. Steele

Me.cboMyCombo.RowSource = Me.cboMyCombo.RowSource & ";" & Me.txtNewProduct

(this assumes your combobox is named cboMyCombo, and that the text to be
added is in a text box named txtNewProduct)
 
A

arthursdomain

Almost worked, now what im getting is something like this
example1
example2
example3
example4;;exampleaddon1;exampleaddon2;exampleaddon3

so everything i add on is becoming part of the last value

I think i need to add (") between Me.txtnewproduct but i tried & """ &
Me.txtnewproduct & """
but that just had the & Me.Txtnewproduct & inputed in the combo box.

also can you show me how to have it save the values in the field.
after i hit enter.

oh also, im using onEnter (event procedure) if theres a better way, or
more efficent way, let me know, thanks again! =) im gonna keep trying
to fidget with it..

Z
 
D

Douglas J. Steele

The code works for me exactly as I typed it.

Do you perhaps have your system set up to use a different delimiter? What
exactly do you have as the RowSource for your combo?

What's the exact code you're using?
 
A

arthursdomain

for my combo box:
name: productname
control source: productname
row source: type: value list
row source: "APC";"BELKIN";"NETGEAR"

the other box where i would input new values:
name: label59
control source: (empty)
onEnter: [Event Procedure]
vb:

Private Sub Label59_Enter()
Me.PRODUCTNAME.RowSource = Me.PRODUCTNAME.RowSource & ";" & Me.Label59
End Sub

Z
 
D

Douglas J Steele

The Enter event would appear to be inappropriate in this case: from the Help
file, "The Enter event occurs before a control actually receives the focus
from a control on the same form". Try using the AfterUpdate event instead.

When I put your code into the AfterUpdate event, it worked perfectly for me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top