Use unbound Check Box on Continuous Form for User Selection

G

Guest

I have a continuous form which displays all check requests waiting on
approval. The fields are locked. I want the user to be able to but a check
next to the items that they are approving and then click a button at the
bottom of the form that performs a specific action. In my case the button
will create a transaction in a new table and update all selected items with
that transaction number and then create a text file with the appropriate
information.

How do I loop thru the records in my form to determine which records have
the check box selected?
 
A

Albert D. Kallal

easy way #1

You have to add an additional column. This column *could* be a related table
if you don't want to add a column to the existing table
(but, easy way is to add that column). This means you have to allow updating
in the continues form.


easy way #2
Use a list box. Since you speak of no editing, then a listbox OFTEN looks
VERY much the same as a continues form.
listboxes have a multi-select property that you can use

Take a look at the screen shots here:

http://www.members.shaw.ca/AlbertKallal/Articles/Grid.htm


solution #3:
I have a sample download that uses a column that is NOT bound to a field,
but populates the check box into a collection.
You can find it here:
Multi Select Example.
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

So, this example shows how to use a checkbox on a continues form that is NOT
bound to a table.
 
F

fredg

I have a continuous form which displays all check requests waiting on
approval. The fields are locked. I want the user to be able to but a check
next to the items that they are approving and then click a button at the
bottom of the form that performs a specific action. In my case the button
will create a transaction in a new table and update all selected items with
that transaction number and then create a text file with the appropriate
information.

How do I loop thru the records in my form to determine which records have
the check box selected?

You can't do anything if the Check Box is not bound to a table field.
It just sits there looking pretty but it doesn't do anything useful.
Add a check box field to your table. Then include that check box field
on your form record source and on the form itself.

Then, when you select the various records, that record will have a
check in the field.
Now when you click on your button, you can reference that check box.

You haven't been specific, so a generic Command button code to update
a field in the table would look something like this:

dim strSQL aas String
strSQL = "Update YourTable Set YourTable.[FieldA] = something
Where YourTable.CheckBoxField = -1;"
CurrentDb.Execute strSQL, dbFailOnError

You then need to clear all of the check marks:
Code a different button....
dim strSQL aas String
strSQL = "Update YourTable Set YourTable.[CheckBoxField = 0;"
CurrentDb.Execute strSQL, dbFailOnError
 
Joined
Jun 2, 2013
Messages
1
Reaction score
0
Anther solution to this problem is to use a list box in multiselect mode.


You can apply this solution without changing table structure. It works great for looping through records.
 

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