Jimbob
Aug 11th, 2000, 04:21 AM
I been getting type mismatch messages when users are addin a nw row to my database. I couldnt figure out what was causing them, as i couldnt recreate them on my pc no matter how hard I tried, so I decided to do a bit of investigating.
I was using this type of structure to add a record
With Recordset
.Addnew
!Field1 = "Something"
!Field2 = "Something Else"
.Update
End With
I set a variable to the name of each field before saving it, and displauyed it in the error handler, eg
On Error Goto ErrHandler
Dim Fieldname as String
With Recordset
.Addnew
Fieldname = "Field1"
!Field1 = "Something"
Fieldname = "Field2"
!Field2 = "Something Else"
.Update
End With
ErrHandler:
Msgbox "Error saving " & Fieldname
The errors all seemed to come from a field that used a DataCombo control. I had used the .MatchedWithList property to make sure that each item was in the list before it was saved. The contents of thelist were 2 letter airline codes, eg BA
Increasing the field length for these fields solved the problem, but I would like to know why this error happened in the first place. The LEN() function tells me that an item selected from this list is only 2 characters in length.
I was using this type of structure to add a record
With Recordset
.Addnew
!Field1 = "Something"
!Field2 = "Something Else"
.Update
End With
I set a variable to the name of each field before saving it, and displauyed it in the error handler, eg
On Error Goto ErrHandler
Dim Fieldname as String
With Recordset
.Addnew
Fieldname = "Field1"
!Field1 = "Something"
Fieldname = "Field2"
!Field2 = "Something Else"
.Update
End With
ErrHandler:
Msgbox "Error saving " & Fieldname
The errors all seemed to come from a field that used a DataCombo control. I had used the .MatchedWithList property to make sure that each item was in the list before it was saved. The contents of thelist were 2 letter airline codes, eg BA
Increasing the field length for these fields solved the problem, but I would like to know why this error happened in the first place. The LEN() function tells me that an item selected from this list is only 2 characters in length.