Hi, I've searched quite a bit on these forums already to no avail, so I decided to post the question:
I have two cascading combo boxes. They work fine. I added a NotInList function for the second combo box.
Ive bolded where I'm having a problem. I need the NotInList to do both:
insert the entered value in the second combo box into the appropriate table column (which works fine)
AND
insert the value from the first combo box into the appropriate table column
When I run the code above, it asks me to manually enter a Parameter for the value of the first combobox, ive tried me.cboMethodType.Value and me.cboMethodType.Column(0) also.
How do I get it to automatically insert the value selected from the first combobox into the appropriate column?>
I have two cascading combo boxes. They work fine. I added a NotInList function for the second combo box.
Code:
Private Sub cboMethodName_NotInList(NewData As String, Response As Integer)
Dim strSql As String
If MsgBox(NewData & " is not currently in the list for [" & Me.cboMethodType.Value & "] recruitment." & vbCrLf & "Would you like to add this now?", vbYesNo + vbQuestion) = vbYes Then
strSql = "INSERT INTO lkptblMethod([MethodName], [B][MethodType][/B]) " & "VALUES ('" & NewData & "', "[B] & Me.cboMethodType &[/B] ");"
Me.cboMethodType.Requery
DoCmd.RunSQL strSql
MsgBox "The new information has been added"
Response = acDataErrAdded
Else
MsgBox "Please enter a valid item from the drop down box."
Response = acDataErrContinue
Me.cboMethodName = ""
End If
Exit Sub
End Sub
Ive bolded where I'm having a problem. I need the NotInList to do both:
insert the entered value in the second combo box into the appropriate table column (which works fine)
AND
insert the value from the first combo box into the appropriate table column
When I run the code above, it asks me to manually enter a Parameter for the value of the first combobox, ive tried me.cboMethodType.Value and me.cboMethodType.Column(0) also.
How do I get it to automatically insert the value selected from the first combobox into the appropriate column?>