If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Combo Box
I use a combo box on a form that links information from a
related table. When I click on the arrow the drop down box shows a list of values already populated in the table. When I type in a value that isn't currently in the related table, I get an message saying it is an invalid value. Is there any way that I can make this box read in a new value into the related or must I always choose from the drop down list? |
#2
|
|||
|
|||
Combo Box
You will need to place code into the combo's NotInList
eventhandler to populate the related table with the new entry. Typically, the code in this eventhandler is along the following lines Private Sub combo(NewData As String, Response As Integer) If MsgBox("Do You Wish to continue with new Value", vbYesNo) = vbYes Then code here to add entry to table or open up another form Response = acDataErrAdded Else combo.Undo Response = acDataErrContinue End If End Sub Hope This Helps Gerald Stanley MCSD -----Original Message----- I use a combo box on a form that links information from a related table. When I click on the arrow the drop down box shows a list of values already populated in the table. When I type in a value that isn't currently in the related table, I get an message saying it is an invalid value. Is there any way that I can make this box read in a new value into the related or must I always choose from the drop down list? . |
#3
|
|||
|
|||
Combo Box
Thanks for the response. I can't seem to use the additem
method to add the new entry. I used a query to populate the combo box from the related table and I don't know if that is what is not allowing me to complete the code. I keep getting an error message when I try to run it. -----Original Message----- You will need to place code into the combo's NotInList eventhandler to populate the related table with the new entry. Typically, the code in this eventhandler is along the following lines Private Sub combo(NewData As String, Response As Integer) If MsgBox("Do You Wish to continue with new Value", vbYesNo) = vbYes Then code here to add entry to table or open up another form Response = acDataErrAdded Else combo.Undo Response = acDataErrContinue End If End Sub Hope This Helps Gerald Stanley MCSD -----Original Message----- I use a combo box on a form that links information from a related table. When I click on the arrow the drop down box shows a list of values already populated in the table. When I type in a value that isn't currently in the related table, I get an message saying it is an invalid value. Is there any way that I can make this box read in a new value into the related or must I always choose from the drop down list? . . |
#4
|
|||
|
|||
Combo Box
You do not need to code the addtion of the entry into the
list. Once the new entry has been added into the table that is the rowsource for the combo, it should appear in the list. Hope This Helps Gerald Stanley MCSD -----Original Message----- Thanks for the response. I can't seem to use the additem method to add the new entry. I used a query to populate the combo box from the related table and I don't know if that is what is not allowing me to complete the code. I keep getting an error message when I try to run it. -----Original Message----- You will need to place code into the combo's NotInList eventhandler to populate the related table with the new entry. Typically, the code in this eventhandler is along the following lines Private Sub combo(NewData As String, Response As Integer) If MsgBox("Do You Wish to continue with new Value", vbYesNo) = vbYes Then code here to add entry to table or open up another form Response = acDataErrAdded Else combo.Undo Response = acDataErrContinue End If End Sub Hope This Helps Gerald Stanley MCSD -----Original Message----- I use a combo box on a form that links information from a related table. When I click on the arrow the drop down box shows a list of values already populated in the table. When I type in a value that isn't currently in the related table, I get an message saying it is an invalid value. Is there any way that I can make this box read in a new value into the related or must I always choose from the drop down list? . . . |
Thread Tools | |
Display Modes | |
|
|