I have managed to write a new code into my table tbl_e_workcode and this now appears in the dropdown.
However I wish to also add a description which will also write to the "descriptio n" field in tbl_e_workcode and i am unsure how to do this.
thank you
However I wish to also add a description which will also write to the "descriptio n" field in tbl_e_workcode and i am unsure how to do this.
thank you
Code:
Private Sub workcode_eng_NotInList(NewData As String, Response As Integer)
Dim mybase As Database, myset As Recordset
Dim ctl As Control
'return control object that points to combo box
Set ctl = Me!workcode_eng
If MsgBox("Add new workcode?", _
vbOKCancel) = vbOK Then
Response = acDataErrAdded
Set mybase = CurrentDb()
Set myset = mybase.OpenRecordset("tbl_e_workcode", dbOpenTable)
myset.AddNew
myset![e_workcode] = workcode_eng.Text
myset.Update
myset.Close
mybase.Close
Me.workcode_eng.Dropdown
Else
Response = acDataErrContinue
ctl.Undo
End If
End Sub
Comment