Not in list

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jacc14
    New Member
    • Jun 2007
    • 116

    #1

    Not in list

    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


    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
  • jacc14
    New Member
    • Jun 2007
    • 116

    #2
    Hi. after sourcing the net I have found the solution.

    Thanks

    Comment

    Working...