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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkbox headache...

Status
Not open for further replies.

childrenfirst

Technical User
Oct 15, 2006
80
0
0
US
Hi,

I am sure that it's a simple question to all the experts on this site. I have a subform that is a continuous form which returns records from a SQL stored precedure.

Each returned record has an associated checkbox,txtCurRec, in the subform. The checkbox's control source is set to be

=IIf([txtCurRec]=[RecID] & [txtSeltop],True,False)

When the subform was first created, everytime when I checked one checkbox, all the checkboxes in the subform will be automatically checked. So, I added three invisiable boxes around each checkbox to label the checkbox and was able to check one record at a time.

However, the problem now is that I want to allow users to select none, one or many checkboxes as they want to, and I am not sure how to fix the problem again...

Please help!

Thank you:)
 
If you need to store the data, why not add a yes/no field to your table?

If you don't need to store the data, it would be best to know what you are trying to accomplish, other than just the physical description. What's the purpose?

Hope this helps!
Tom

Born once die twice; born twice die once.
 
Hi,

The checkboxes in the subform are under a column called "delete", and after users select which record they want to delete from the record table (there are two columns in the record table, one is called Delete, and the other is called Approved. Both columns are needed for other reasons.), the vba code should hopefully collect the associated value to each checkbox and update the record table based on the collection of associated value.

I hope this helps you understand my needs a little bit better.

Thank you very much for your help!
 
Did you insert the checkbox as an unbound control and then use this in the property sheet for the control source:
Code:
=IIf([txtCurRec]=[RecID] & [txtSeltop],True,False)
or did you create a yes/no field in your table with that statement as the default record value?

Now that I have read your post a few times, it begins to sound like this is not an MS Access forms question, but a VB.Net question. I wonder this since you mention an SQL stored procedure.

What is your development platform? Access? Something else?

In any case, I also notice a few other things which are not quite clear.
1. Naming a checkbox control txtCurRec. txt normally refers to something which returns a text data type like a text box. A checkbox returns yes/no, true/false, -1/0. This is a boolean data type, not text.
2. A record ID is often a long integer, which is numeric not text, so I'm wondering why you are comparing a boolean with a text type when your application looks like it's expecting a long?

If your checkbox is stored in your table and you are using an Access subform which is bound to your table, then all you need to do is display the subform in design view, delete the checkbox you are currently using and insert the check box from your subform's field list. Done this way, any record in the table whose value is set to delete will check the delete field in the form when it is displayed. You will need to do the same thing for the approved field, which I assume is also a yes/no data type in your table.

It sounds like you would like to delete the records after the user selects them.
the vba code should hopefully collect the associated value to each checkbox and update the record table based on the collection of associated value.

The values will be stored in the table before any code runs if your checkboxes are bound to the table. Once those values are stored, you could put together a quick delete query which will delete any record whose delete field is set to True.

Here's what that would look like:
screenshot.bmp


You could then put a command button on your subform's header or footer area to run the delete query.

In any case, I'm not sure we have cleared up all your confusion or not, but I hope I have given you enough to get started in the right direction.

Tom

Born once die twice; born twice die once.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top