I
ionic-fire via AccessMonster.com
I have a form which opens up a subform. On subform, there is a tab control
which has five tabs on it. Each tab contains a sub-form on it. I have a combo
box on one of these sub-forms to which I am attempting to add in
functionality to implement a recent entries list. I have the following code
added to this sub-form's control's AfterUpdate event. However, this event
does not fire after the field is updated. I have verified this by inserting
breakpoints in the code, and the breakpoint never fires either.
Any idea why the AfterUpdate event is not firing? Any input would be great.
Thanks!
'************************************************************
Private Sub cmbParameterName_AfterUpdate()
'add new entries to recent parameters lookup list.
On Error GoTo ErrorHandler
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim boolFound As Boolean
Dim foo As String
Set db = CurrentDb
Set rs = db.OpenRecordset("tblRecentParameters", dbOpenDynaset)
boolFound = False 'set initial found status to false!
While Not rs.EOF
foo = rs.Fields("RecentParameter") 'store current recordset's
value
If foo = cmbRecentParameter Then
boolFound = True 'value found in table
End If
foo = "" 'reset string
rs.MoveNext 'move to next record
Wend
On Error Resume Next 'ignore errors
If boolFound = False Then 'value not found. add to table
rs.AddNew 'add new record to table
rs.Fields("RecentParameter") = cmbRecentParameter
rs.Update
End If
rs.Close
Set rs = Nothing
Set db = Nothing
Exit_ErrorHandler:
Exit Sub
ErrorHandler:
MsgBox Err.Description
Resume Exit_ErrorHandler
which has five tabs on it. Each tab contains a sub-form on it. I have a combo
box on one of these sub-forms to which I am attempting to add in
functionality to implement a recent entries list. I have the following code
added to this sub-form's control's AfterUpdate event. However, this event
does not fire after the field is updated. I have verified this by inserting
breakpoints in the code, and the breakpoint never fires either.
Any idea why the AfterUpdate event is not firing? Any input would be great.
Thanks!
'************************************************************
Private Sub cmbParameterName_AfterUpdate()
'add new entries to recent parameters lookup list.
On Error GoTo ErrorHandler
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim boolFound As Boolean
Dim foo As String
Set db = CurrentDb
Set rs = db.OpenRecordset("tblRecentParameters", dbOpenDynaset)
boolFound = False 'set initial found status to false!
While Not rs.EOF
foo = rs.Fields("RecentParameter") 'store current recordset's
value
If foo = cmbRecentParameter Then
boolFound = True 'value found in table
End If
foo = "" 'reset string
rs.MoveNext 'move to next record
Wend
On Error Resume Next 'ignore errors
If boolFound = False Then 'value not found. add to table
rs.AddNew 'add new record to table
rs.Fields("RecentParameter") = cmbRecentParameter
rs.Update
End If
rs.Close
Set rs = Nothing
Set db = Nothing
Exit_ErrorHandler:
Exit Sub
ErrorHandler:
MsgBox Err.Description
Resume Exit_ErrorHandler