H
hhhh
Hello all,
I have a combo box on a form with 2 columns. When a new value is entered I
am using the NotInList event to handle it. My problem is I have a second
column in the Combo Box that represents the full description of the first
Column and I haven't been able to update that field with the new full
description. The second column comes from the same table the first
does(tblDDLTaskTypes).
I had started to program in an Input box to accept the new description value
but am getting object errors among others. I am not that experienced with
vba and can't get the syntax correct. I have inherited this db and am not
sure which way to go.
Here is the code that accepts the new value. I have not been able to figure
out how to get the second field entered with an InputBox.
Private Sub Task_NotInList(NewData As String, Response As Integer)
Dim strTask As String
Dim MessValue As Integer
Dim Msg As String
'Exit this sub if the combo box is cleared of values
If NewData = "" Then Exit Sub
'Message for the New Data message box
Msg = "'" & NewData & "' is not currently in the list of Task Types." & vbCr
& vbCr
Msg = Msg & "Do you want to add it?"
'Here is the message box that pops up making reference to the field
MessValue = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Task Type...")
If MessValue = vbYes Then
'here is where the table and field are referenced for the list
strTask = "Insert Into tblDDLTaskTypes ([Task]) values ('" & NewData &
"')"
'This is where the new value is added to that field to the first
column
CurrentDb.Execute strTask, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
Thanks, I haven't worked with double column combo/notinlist situations
before,
Many TIA,
E.
I have a combo box on a form with 2 columns. When a new value is entered I
am using the NotInList event to handle it. My problem is I have a second
column in the Combo Box that represents the full description of the first
Column and I haven't been able to update that field with the new full
description. The second column comes from the same table the first
does(tblDDLTaskTypes).
I had started to program in an Input box to accept the new description value
but am getting object errors among others. I am not that experienced with
vba and can't get the syntax correct. I have inherited this db and am not
sure which way to go.
Here is the code that accepts the new value. I have not been able to figure
out how to get the second field entered with an InputBox.
Private Sub Task_NotInList(NewData As String, Response As Integer)
Dim strTask As String
Dim MessValue As Integer
Dim Msg As String
'Exit this sub if the combo box is cleared of values
If NewData = "" Then Exit Sub
'Message for the New Data message box
Msg = "'" & NewData & "' is not currently in the list of Task Types." & vbCr
& vbCr
Msg = Msg & "Do you want to add it?"
'Here is the message box that pops up making reference to the field
MessValue = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Task Type...")
If MessValue = vbYes Then
'here is where the table and field are referenced for the list
strTask = "Insert Into tblDDLTaskTypes ([Task]) values ('" & NewData &
"')"
'This is where the new value is added to that field to the first
column
CurrentDb.Execute strTask, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
Thanks, I haven't worked with double column combo/notinlist situations
before,
Many TIA,
E.