Kysteratwork
Technical User
Hi all,
I found this fantastic code online (unfortunately I forgot where) which lets the user add a new record to a dropdown (ice cream flavours in this case), if the record is not in the list.
I would love to apply this code to one of my dropdowns, but slightly elaborated: it contains FirstName and LastName... (The dropdown shows EmployeeID and Name:[FirstName] &" "&[LastName])
Isn't there a smooth way to that it adds first the first name, then it asks me for the last name?
Can anyone help me out?
Kysteratwork
I found this fantastic code online (unfortunately I forgot where) which lets the user add a new record to a dropdown (ice cream flavours in this case), if the record is not in the list.
Code:
Private Sub Combo111_NotInList(NewData As String, Response As Integer)
Dim rstFlavors As ADODB.Recordset
Dim intAnswer As Integer
On Error GoTo ErrorHandler
intAnswer = MsgBox("Add " & NewData & " to the list of currencies?", _
vbQuestion + vbYesNo)
If intAnswer = vbYes Then
Set rstFlavors = New ADODB.Recordset
rstFlavors.Open "Icecream", CurrentProject.Connection, _
adOpenStatic, adLockOptimistic
rstFlavors.AddNew
rstFlavors!flavour = NewData
rstFlavors.Update
Response = acDataErrAdded
Else
Response = acDataErrDisplay
End If
rstFlavors.Close
Set rstFlavors = Nothing
Exit Sub
ErrorHandler:
MsgBox "Error #: " & Err.Number & vbCrLf & vbCrLf & Err.Description
End Sub
Isn't there a smooth way to that it adds first the first name, then it asks me for the last name?
Can anyone help me out?
Kysteratwork