joelindquist
MIS
I've got a dilemma in that I need to perform an update query based on the values in a listbox. Not bad so far. Enter my Dilemma...
I need to check if there is a null value as the only option in the list box, and if so, use a query to overwrite this value, or if there are multiple values, (no NULL) then append a record to the table.
I have a table with 3 fields (composite primary key)
Area, Type, Detail
Each area will have multiple Types.
Each type will have multiple Details.
So Far, to add a new area, I insert (NEW_VALUE, Null, Null), but then I need to add a type under that area, and replace the previous entry with (Area, NEW_VALUE, Null)
Here's the applicable part of my code:
Private Sub AddAreaButton_Click()
DoCmd.RunSQL "INSERT INTO Possibilities (Area, Type, Detail) VALUES ( '" + Me.AddArea.Value + "', Null, Null);"
Me.AddArea.Value = Null
DoCmd.Requery "Area"
End Sub
'---------------------------------------------
Private Sub AddTypeButton_Click()
If ((Me.Type.ListCount = 1) And (THIS IS WHERE I NEED HELP)) Then
MsgBox ("This will overwrite the Null Entry"
End If
End Sub
Thanks to anyone able to help.
I need to check if there is a null value as the only option in the list box, and if so, use a query to overwrite this value, or if there are multiple values, (no NULL) then append a record to the table.
I have a table with 3 fields (composite primary key)
Area, Type, Detail
Each area will have multiple Types.
Each type will have multiple Details.
So Far, to add a new area, I insert (NEW_VALUE, Null, Null), but then I need to add a type under that area, and replace the previous entry with (Area, NEW_VALUE, Null)
Here's the applicable part of my code:
Private Sub AddAreaButton_Click()
DoCmd.RunSQL "INSERT INTO Possibilities (Area, Type, Detail) VALUES ( '" + Me.AddArea.Value + "', Null, Null);"
Me.AddArea.Value = Null
DoCmd.Requery "Area"
End Sub
'---------------------------------------------
Private Sub AddTypeButton_Click()
If ((Me.Type.ListCount = 1) And (THIS IS WHERE I NEED HELP)) Then
MsgBox ("This will overwrite the Null Entry"
End If
End Sub
Thanks to anyone able to help.