Change Order of Controls?

M

Mr. JYC

Hello,

I have a form with a bunch of check boxes. The check boxes appear in a
certain order on the form. I wrote some code that would check to see if the
check boxes were checked. The pseudo code follows:

dim ctl as control

for each ctl in me.controls

check to see if check box is checked

next ctl

I need the checks to be done in the order that they appear on the form. I
added in a new check box in the middle of the other check boxes. When the
code does the checks, the new check box is always checked last. Is this
something I can change or is this default behavior? I need to have it check
in the order it appears on the form.
 
L

Linq Adams via AccessMonster.com

Why do the checkboxes have to be checked in a certain order?
 
M

Mr. B

Hi, Mr. JYC.

If you have a requirement that the status of the check boxes be checked in a
specific order, I would suggest that you create a user defined function that
will check each check box in the order you want it checked. Then just call
that function each time you what the check boxes checked. You can have that
function to return a value based to the results of the check of the check
boxes.

You could even include a Select Case statement that would inform the user
via a message box which check box or boxes were not cheched based on the
value returned by your function.
 
J

John W. Vinson

I have a form with a bunch of check boxes. The check boxes appear in a
certain order on the form. I wrote some code that would check to see if the
check boxes were checked. The pseudo code follows:

dim ctl as control

for each ctl in me.controls

check to see if check box is checked

next ctl

I need the checks to be done in the order that they appear on the form. I
added in a new check box in the middle of the other check boxes. When the
code does the checks, the new check box is always checked last. Is this
something I can change or is this default behavior? I need to have it check
in the order it appears on the form.

If you just loop through the controls collection it will loop in the order in
which the controls were created. What you might do is store a sequential
number in the control's Tag property and use that to identify which control is
next. I can't think of a good way to use that value to drive the loop though!

The NEED to do this really makes me suspect an underlying flaw in the table
normalization, though. One table field (*are* these bound controls??) should
not depend on other fields; and if the order of data entry is critical, you
should make controls invisible or disabled until they can legitimately be
edited.
 

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