Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking values of listbox options (selected or unselected)

Status
Not open for further replies.
Jul 18, 2001
13
US
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top