B
Benjamin
I have a combo box I am using to delete items from a table. The code looks
like this:
If Response = vbOK Then
DoCmd.RunSQL "DELETE FROM ClassTbl WHERE Class = '" + Class.Value +
"';"
DoCmd.RunSQL "Delete from StudentTbl Where Class = '" + Class.Value
+ "';"
DoCmd.RunSQL "Delete from DataTbl Where Class = '" + Class.Value +
"';"
Class.Value = ""
Class.Requery
End If
the problem is that i am using class.value = "" to make the combox blank so
that the item that was just deleted doesn't still show up as the selected
item in the list. I have found that the requery alone will not change the
value if the item selected is not in the list. The major problem I am having
is that when the user closes the form with this combo box blank it creates a
new blank record, even though the class field is set to not accept nulls and
is even the primary key it doesn't even display an error message it just puts
a blank field right on into the table. Is there a way around this?
like this:
If Response = vbOK Then
DoCmd.RunSQL "DELETE FROM ClassTbl WHERE Class = '" + Class.Value +
"';"
DoCmd.RunSQL "Delete from StudentTbl Where Class = '" + Class.Value
+ "';"
DoCmd.RunSQL "Delete from DataTbl Where Class = '" + Class.Value +
"';"
Class.Value = ""
Class.Requery
End If
the problem is that i am using class.value = "" to make the combox blank so
that the item that was just deleted doesn't still show up as the selected
item in the list. I have found that the requery alone will not change the
value if the item selected is not in the list. The major problem I am having
is that when the user closes the form with this combo box blank it creates a
new blank record, even though the class field is set to not accept nulls and
is even the primary key it doesn't even display an error message it just puts
a blank field right on into the table. Is there a way around this?