J
Jim Evans
I need to update a Field named CID in a table named tblCID based on the
selection in a combobox where Column 0 = the CID.
This code runs but doesn't update the field value, though it does find the
correct record on thr form. The MsgBoxes both show the correct value..
What an I doing incorrectly?
All help appreciated.
tia,
Jim Evans
Private Sub Combo50_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Dim dbs As Database
Dim rst As DAO.Recordset
Dim CID As Integer
Set rs = Me.Recordset.Clone
rs.FindFirst "[CustomerID] = " & Str(Nz(Me![Combo50], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tblCID", dbOpenTable)
With rst
.MoveFirst
.Edit
CID = Combo50.Column(0)
.Update
.Close
End With
MsgBox (Combo50.Column(0))
MsgBox (CID)
Combo50 = Null
FirstName.SetFocus
End Sub
selection in a combobox where Column 0 = the CID.
This code runs but doesn't update the field value, though it does find the
correct record on thr form. The MsgBoxes both show the correct value..
What an I doing incorrectly?
All help appreciated.
tia,
Jim Evans
Private Sub Combo50_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Dim dbs As Database
Dim rst As DAO.Recordset
Dim CID As Integer
Set rs = Me.Recordset.Clone
rs.FindFirst "[CustomerID] = " & Str(Nz(Me![Combo50], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tblCID", dbOpenTable)
With rst
.MoveFirst
.Edit
CID = Combo50.Column(0)
.Update
.Close
End With
MsgBox (Combo50.Column(0))
MsgBox (CID)
Combo50 = Null
FirstName.SetFocus
End Sub