Smilesxl
asked on
Form based on a table with a check box field, need select all
I have a table that opens in a form, it is a list of parts in an inventory database. I use it to relieve inventory for an assembly when we are pulling parts from the crib to build. You need to select the parts in the assembly you are pulling, most of the time you want to select all, there are times when you would pick only a few parts. I would like a button at the top of the form "Select All", would be nice if you hit it a second time, it "Un-Selects All". This is a field in a table. I tried to attach query to the button, but then I will have to refresh the form etc.. Looking for the best way to do it. I am using MS Access 2013.
ASKER
That didn't work, tried this and this didn't work either.
Private Sub SelectAll_Click()
Dim bSelect As Boolean
Dim strSQL As String
bSelect = (Me.SelectAll_Click.Captio n = "Select All")
strSQL = "UPDATE [Part List] SET [PICK] = Yes"
CurrentDb.Execute strSQL, dbFailOnError
Me.SelectAll_Click.Caption = IIf(bSelect, "Un-select All", "Select All")
Me.Refresh ' refreshes the form
End Sub
Private Sub SelectAll_Click()
Dim bSelect As Boolean
Dim strSQL As String
bSelect = (Me.SelectAll_Click.Captio
strSQL = "UPDATE [Part List] SET [PICK] = Yes"
CurrentDb.Execute strSQL, dbFailOnError
Me.SelectAll_Click.Caption
Me.Refresh ' refreshes the form
End Sub
ASKER
Also, the field is a yes/no field, with a check box display control. The field name is "PICK"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Awesome, thank you. =)
Open in new window