Hi All,
tHERE'S a piece of VB code to synchronise my form to the value in the Combo Box. The VB code is attached to the After Update event of the Combo Box. And sometimes when I select a value on my Combo Box, I get the ERROR message. I suspect there’s something wrong with my code. I can’t seem to figure it out because my knowledge in VB is very limited and basic. What could be wrong???
The error message says: UPDATE OR CANCELUPDATE WITHOUT ADDNEW OR EDIT.
hERE's the VB code:
Private Sub Benton_AfterUpdate()
Dim rs As Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "[BRK_ENTITY_NO] = " & [Forms]![frmbroker]![Benton]
If (DCount("*", "[Broker Information]", "[BRK_ENTITY_NO] = [forms]![frmBroker]![Benton]") = 0) Then
MsgBox " OOPS!!!THE VALUE ENTERED," & [Benton] & " IS NOT A VALID BROKER NUMBER"
Me.Benton.Value = Null
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End Sub
tHERE'S a piece of VB code to synchronise my form to the value in the Combo Box. The VB code is attached to the After Update event of the Combo Box. And sometimes when I select a value on my Combo Box, I get the ERROR message. I suspect there’s something wrong with my code. I can’t seem to figure it out because my knowledge in VB is very limited and basic. What could be wrong???
The error message says: UPDATE OR CANCELUPDATE WITHOUT ADDNEW OR EDIT.
hERE's the VB code:
Private Sub Benton_AfterUpdate()
Dim rs As Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "[BRK_ENTITY_NO] = " & [Forms]![frmbroker]![Benton]
If (DCount("*", "[Broker Information]", "[BRK_ENTITY_NO] = [forms]![frmBroker]![Benton]") = 0) Then
MsgBox " OOPS!!!THE VALUE ENTERED," & [Benton] & " IS NOT A VALID BROKER NUMBER"
Me.Benton.Value = Null
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End Sub