Check all or uncheck all

G

Guest

Hi I have a question i am new using access an I created a form that has three
fields 1. Code, 2, Description 3. Print (Check Box (Yes/No option)).

Now when a user opens that form he is able to select hte codes that he whant
to print.... but my problem is when the user want to print a different set of
codes he needs to uncheck the one he selected before, therfore I need
something that allows the user to check all on uncheck all..... Any
ideas!!!!!!!!!!........ Thanks for your help!!!!

Dorst
 
J

John Spencer

If the table with the fields is being used, you can use an update query to
set all the Print Checkboxes to true or false. ANd then you can refresh the
form.

UPDATE YourTableName
Set [CheckBox Field] = True

You can do this with vba code in a button on the form.

Add a button to your form
Name the button btnSetAllTrue

In the properties, enter [Event Procedure] for the On Click Event
Click the button "..." at the end

Enter the following code substituting your table and field names.


Private Sub btnSetAllTrue_Click()

Dim strSQL As String

strSQL = "UPDATE [YourTable Name] SET [YourCheckBoxField] = True"
CurrentDb().Execute strSQL
Me.Refresh

End Sub

Add another button to uncheck all the items and replace true with false.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top