Show/Hide bound check box on Split Form

Bassbase

Registered User.
Local time
Today, 06:37
Joined
Apr 21, 2013
Messages
11
Hi all,

I realise this has been discussed in other thread but the ones i've found refer to unbound checkboxes and single forms/sub forms.

I have a Split form displaying parts information and have all data displayed from the table including an obsolete field which is a Yes/No checkbox.

I want to display ONLY unchecked fields on a button click.

I have tried this code so far but it didn't seem to have any effect

Code:
Private Sub cmdCurrent_Click()

Me.chkObsolete.Visible = Nz(Me.chkObsolete.Value, True)
Me.Requery

End Sub


Commands:
- cmdCurrent = show all unchecked fields
- cmdShowAll = show all fields
- cmdSearch = filter based on textbox entry

Other:
There is also a hyperlink in each field (on the form only) to open each individual record for editting.

I hope this is all the information needed. I can post the code for all other commands if needed

Field in question is chkObsolete
Command in question cmdCurrent

Many thanks

James
 
try

chkObsolete.Visible = Not chkObsolete

You only need the the nz if you have set the triple state to true
 
Thanks CJ,

Unfortunately its still will only refresh the data and not filter it.

Thank you for your suggestion!
James
 
Not quite sure what you mean - hiding or showing a control will not filter the data in itself

If you want to do that, then use the form filter property

me.filter="[chkObsolete]=" & chkobsolete
me.filteron=true

Where [chkObsolete] is the name of the field in your table
 
Sorry, my poor explanation. I mean any record checked in the chkObsolete field will not be displayed on the screen.

The code you gave checked everything on screen. which is further than i managed to get but not the result i was after.

Thanks for you help so far
 
Ok after much head scratching i'm still no better off.

I've also tried this code

Code:
Private Sub Command69_Click()

If Me.chkObsolete.Value = True Then
 Me.chkObsolete.Visible = False
 Me.Refresh
 
End If

End Sub

To no success.

Every record has a tickbox in it which has a control source in the main table.

I'm very new to access so forgive me if this is actually alot simpler than i'm making it.
 
For anyone else wondering the same thing as me I managed to achieve this result by simply filtering the form on load (Which i didn't realise i could do :banghead:)

I simple put this piece of code in the record source:

Code:
SELECT * FROM Mainstock WHERE Mainstock.Obsolete =0;

And made a seperate form to veiw/edit obsolete parts with the same code bar the numerical value at the end of the statement to show all ticked records

Code:
SELECT * FROM Mainstock WHERE Mainstock.Obsolete =-1;

So to recap, The top section of code displays only UNCHECKED records

The code below it show only CHECKED records.

Hope this helps anyone else with my level of noob status!
 

Users who are viewing this thread

Back
Top Bottom