Hi Guys,
Just ran into a strange error and I'm hoping someone can tell me what's going on. I have a procedure that basically pulls the data from the current record and places it in the correct control on my form. No problems until I try to pull the data for the Description field and put it in a textbox field on my form. My code does a null check on the Description field and produces an Invalid Use of Null Error Message. This makes no sense since I'm checking for Null but I know it has something to do with the screwy nature of the null value itself. Basically, the routine just goes field by field and checks if data is available in that field. If so the data is placed in the control. If not the control is set to a cleared state. Here's the code. Any help you can provide is appreciated.
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
cmbCardCategory.Value = rs("Category ID")
Else
cmbCardCategory.Value = -1
End If
If Not IsNull(rs("Attribute ID")) Then
cmbCardAttribute.Value = rs("Attribute ID")
Else
cmbCardAttribute.Value = -1
End If
txtLevel.SetFocus
If Not IsNull(rs("Level")) Then
txtLevel.Text = rs("Level")
Else
txtLevel.Text = vbNullString
End If
If Not IsNull(rs("Monster Type ID")) Then
cmbMonsterType.Value = rs("Monster Type ID")
Else
cmbMonsterType.Value = -1
End If
txtAttackPoints.SetFocus
If Not IsNull(rs("Attack Points")) Then
txtAttackPoints.Text = rs("Attack Points")
Else
txtAttackPoints.Text = vbNullString
End If
txtDefensePoints.SetFocus
If Not IsNull(rs("Defense Points")) Then
txtDefensePoints.Text = rs("Defense Points")
Else
txtDefensePoints.Text = vbNullString
End If
If Not IsNull(rs("Card Type ID")) Then
lstCardType.Value = rs("Card Type ID")
Else
lstCardType.Value = -1
End If
txtPendulumScale.SetFocus
If Not IsNull(rs("Pendulum Scale")) Then
txtPendulumScale.Text = rs("Pendulum Scale")
Else
txtPendulumScale.Text = vbNullString
End If
txtLevel.SetFocus
If Not IsNull(rs("Level")) Then
txtLevel.Text = rs("Level")
Else
txtLevel.Text = vbNullString
End If
txtDescription.SetFocus
If Not IsNull("Description") Then
txtDescription.Text = rs("Description")
Else
txtDescription.Text = vbNullString
End If
If Not IsNull("Forbidden") Then
chkForbidden.Value = rs("Forbidden")
Else
chkForbidden.Value = False
End If