I have a form that has a combobox that I use for a search field. Also on that form there are several text boxes that reflect the different fields of the database. The textboxes are bound to the database so that changes can be made easily.When a person selects a data member in the combobox the textboxes reflect the data for the selected item. The problem is that I have one text bix that I want to show certain text depending on the data in one of the textboxes. I am using the AfterUpdate method of the combobox and all works fine until I try to place the data in the text box. Here is the code:
Private Sub cmbCDC_AfterUpdate()
' Find the record that matches the control.
If IsNull(cmbCDC) Then Exit Sub
Me.RecordsetClone.FindFirst "[ID] = " & Me![cmbCDC]
Me.Bookmark = Me.RecordsetClone.Bookmark
txtClass.SetFocus
If txtClass.Text = "" Then
txtLevel.SetFocus
txtLevel.Text = "Unknown"
Exit Sub
End If
txtClass.SetFocus
Select Case CInt(txtClass.Text)
Case 0 To 26
txtLevel.SetFocus
txtLevel.Text = "Level 1"
txtName.SetFocus
Case 27 To 34
txtLevel.SetFocus
txtLevel.Text = "Level II"
txtName.SetFocus
Case 35 To 50
txtLevel.SetFocus
txtLevel.Text = "Level III"
txtName.SetFocus
Case Is > 50
txtLevel.SetFocus
txtLevel.Text = "Level IV"
txtName.SetFocus
End Select
End Sub
The problem comes when I try to place the text into the textbox. I get the following error: Run-Time Error'2115'
The macro or function set to the BeforeUpdate orValidationRule property for this field is preventing Microsoft Access from saving ther data in the field.
I do not have either of these set, so what could be the problem?
Thanks in advance
Rick
Private Sub cmbCDC_AfterUpdate()
' Find the record that matches the control.
If IsNull(cmbCDC) Then Exit Sub
Me.RecordsetClone.FindFirst "[ID] = " & Me![cmbCDC]
Me.Bookmark = Me.RecordsetClone.Bookmark
txtClass.SetFocus
If txtClass.Text = "" Then
txtLevel.SetFocus
txtLevel.Text = "Unknown"
Exit Sub
End If
txtClass.SetFocus
Select Case CInt(txtClass.Text)
Case 0 To 26
txtLevel.SetFocus
txtLevel.Text = "Level 1"
txtName.SetFocus
Case 27 To 34
txtLevel.SetFocus
txtLevel.Text = "Level II"
txtName.SetFocus
Case 35 To 50
txtLevel.SetFocus
txtLevel.Text = "Level III"
txtName.SetFocus
Case Is > 50
txtLevel.SetFocus
txtLevel.Text = "Level IV"
txtName.SetFocus
End Select
End Sub
The problem comes when I try to place the text into the textbox. I get the following error: Run-Time Error'2115'
The macro or function set to the BeforeUpdate orValidationRule property for this field is preventing Microsoft Access from saving ther data in the field.
I do not have either of these set, so what could be the problem?
Thanks in advance
Rick