hide a row once checkbox is checked

laluna

New member
Local time
Today, 02:33
Joined
Aug 9, 2016
Messages
7
hello everyone , im new here and im still a beginner
i want to hide a row in a tabular form , once i check the checkbox , how can I do it !! plz help me im lost
 

Attachments

  • Capture d'écran 2016-08-09 13.35.12.jpg
    Capture d'écran 2016-08-09 13.35.12.jpg
    95.1 KB · Views: 262
is the checkbox bound to a field in the forms RowSource?

I would use the checkboxes afterupdate event to refresh/requery the form.
 
yes it is bound , i want to hide not to refresh the querry , i dunno which code vba should i use , i looked everywhere and didn't find what im looking for , i want to hide the whole row once i checked the checkbox , or even if it's not possible with hiding at least changing the color of the row and make it green for example ,( plz check the attached picture )
 
Do you need all the data to show at any time or just the unchecked records?

The way to do this is to either filter the data on your form so only records where the checkbox is false show OR (and possibly the better method) create a query to use as the recordsource for your form and have the criteria of checkboxField = false in the query. If you want the option of showing checked records, place a checkbox in the forms header to use as a filter and reference this in the query.
 
sorry for troubling you , that's not how i want to do it , to show only the unchecked data ,i want once i check the checkbox in each row , the row disappear , and row under it will take it's position , i hope im clear and that u could at least understand what i want to say , thanks a lot for your time , i want only to know if it's possible , if it's not then ill try your suggestion
 
OK,lets check what you want to achieve and what you mean by disappear.

  1. Do you mean for the record to be PERMANENTLY deleted?
  2. Do you mean for the record to not be visible?
 
the record to not be visible that's what i mean
 
Right so to make 1 or more records not visible, you need to provide a criteria so the form knows what to 'hide'. This goes back to post #4.

So, what is the RecordSource of your form?
  1. Table
  2. Query

If a table, then you will need to set a filter on the form. If a query you need to add the criteria to the query. Either way, if you refresh the form AFTER 'ticking' a checkbox, that record will disappear.In generic terms;
Code:
(CheckBox_Field=FALSE)

Let me know which of the above and the name of the field that the checkbox is bound to and i will show you how.
 
the recordsource of my form is a query ,the name of the field of the checkbox , if check , here's my database attached plz take a look , the form name is "commande " a, the querry name is "Commande "
 

Attachments

thanks i found a solution , i created a filtered copy of my query ( put false on criteria of field check ), shows only the unchecked records and i created a new form
on afterupdate i put the code :
Me.RecordSource = "SELECT * FROM COMMANDE WHERE check = False"
Me.Requery
now i want a button to show the hidden records , thanks again for your help
 
laluna, you basically already have it in the coding you've got.

Put the below code in the after update event of the checkbox
Code:
Private Sub Check15_AfterUpdate()
Me.Requery
End Sub

This will hide the just clicked record if you are displaying Checked=FALSE OR if you are displaying Checked = TRUE.

Now if you are displaying all records nothing will happen. If you want to hide JUST the last clicked record, you would need to have a unique recordID to filter out.
 
thanks for your help , i have found the solution , iv created another filtered query that shows only checked records , on the same form iv created a button , where i put the put the same code ( reverse true with false ) . thanks a lot isskint :) , here's my database if you want to take a look , if you have any remarks plz help yourself xd
 

Attachments

Laluna, Isskint is trying to point out that you're making more work for yourself. Your query is already screening out records with that box checked. Adding that one line of code (Me.Requery) he suggested to the AfterUpdate event will do precisely what you asked without having to apply additional filters.
 

Users who are viewing this thread

Back
Top Bottom