Can not write values to Db in Access form.
Posted on 2016-08-02
Please consider the code snippet below.
When a combo box selection is made I want that value (cboManpower.Text) along with another value (txtIDNumber.Text ) from the same form to be written to the tblPersonel tabel of the Manpower.accb database.
I am receiving an error saying that I can not reference the property of a control unless it has focus.
Private Sub cboManpower_Change()
Dim dbs as Database
Set dbs = OpenDatabase("Manpower.accdb")
dbs.Execute "INSERT INTO tblPersonel (IDNumber, FullName) VALUES (" & Me.txtIDNumber.Text & ", '" & Me.cboManpower.Text & "');"