Hi Guys,
I've created a very simple data entry form with basic functions like Add Edit Delete Move First and such. I decided to add a method for searching for a specific record and displaying the record. The method I use is to select the search value from a combo box and then use FirdFirst to find the record and set the controls equal to their field values. I call the same code I use to display the data during regular move operations. However when I call the code under the search condition it produces error number 2115 The macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing Microsoft Access from saving the data in the field. All fields are unbound controls as far as controls being bound to a field in the table but combo boxes and such are populated with data from their associated lookup tables. There is NO ValidationRule and nothing is happening in the BeforeUpdate event procedure.
I could really use some help here. This error makes NO sense to me at all given that the same code works just fine during move operations. I've included all code below.
Thanks In Advance
Code:
Private Sub cmbCards_Click()
rs.FindFirst ("[Card Name] = '" & cmbCards.Text & "'")
If Not rs.NoMatch Then
GetCardData
End If
End Sub
Code:
Private Sub GetCardData()
LoadCardFields
LoadCardImage
End Sub
Code:
Private Sub LoadCardFields()
txtCardName.SetFocus
If Not IsNull(rs("Card Name")) Then
txtCardName.Text = rs("Card Name")
Else
txtCardName.Text = vbNullString
End If
If Not IsNull(rs("Category ID")) Then
cmbCardCategories.Value = rs("Category ID")
Else
cmbCardCategories.Value = -1
End If
'If Not IsNull(rs("Card Type ID")) Then
' cmbCardType.Value = rs("Card Type ID")
'Else
' cmbCardType.Value = -1
'End If
If Not IsNull(rs("Monster Type ID")) Then
cmbMonsterType.Value = rs("Monster Type ID")
Else
cmbMonsterType.Value = -1
End If
CheckCardCategory
End Sub
Code:
Private Sub LoadCardImage()
imgCard.Picture = sPath & rs("File Name")
End Sub
Code:
Private Sub CheckCardCategory()
If cmbCardCategories.Value = "M" Then
cmbMonsterType.Enabled = True
Else
cmbMonsterType.Enabled = False
End If
End Sub