Link to home
Start Free TrialLog in
Avatar of dkilby
dkilbyFlag for Canada

asked on

ms access + remove values from combo box

I have a form, and on the form there is a text box and a combo box, the text box is readonly, and the combo box is populated from a table.

The user selects a value from the combo box, and it adds what they selected to the value of the textbox.

is there a way to remove the value from the the combo box once selected, or a way to check the text in the textbox to see if the value was already added?  

The text box could have several words inside, each separated by a comma.
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

What is the code you have for the combo box events now ?

mx
Avatar of dkilby

ASKER

i am using visual basic on the afterupdate event
Yes I know ... can you post that code ?

mx
Avatar of dkilby

ASKER

ah sorry - here is the code.

Private Sub cboKeywords_AfterUpdate()
    Dim str As String
   
    str = str & Me.cboKeywords
   
    Me.txtKeywords = Me.txtKeywords & str & ", "
End Sub
ok ...then to clear the combo:

Private Sub cboKeywords_AfterUpdate()
    Dim str As String
   
    str = str & Me.cboKeywords
   
    Me.txtKeywords = Me.txtKeywords & str & ", "

    Me.cboKeyWords= Null ' *********** add this

End Sub
Avatar of dkilby

ASKER

can i also check the value of txtKeywords to make sure the value of cboKeywords has not already been added?

Avatar of dkilby

ASKER

i think the actual code is missing?
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dkilby

ASKER

Perfect thanks for the help