D
David Gartrell
Hi there,
I wonder if anyone can help me with a couple of problems I'm having with
Access 2000.
Firstly, I have a form and within that a subform that contains 10 text boxes
called weight1, weight2, weight3 and so on up to weight10. On the main form
I have some VB code that checks the contents of all ten boxes. At the moment
I have a seperate piece of code to check each text box when I would much
rather reference each one via a simple for...next loop. I have tried to
accomplish this but never seem to have any luck getting it to work. I know
that if everything resided on the main form it would be an easy task and i
would use some code such as:
for loop1 = 1 to 10
if me("weight"+format$(loop1))=100 then foundbox.visible = true
next
What I can't work out is how change the second line so it will look at each
box on the subform as part of the loop. I understand the principle of
[forms]![my subform]! etc etc but can't work out the correct syntax for
referencing them within a simple loop.
The problem I'm having is that I also have an 'after update' event procedure
against each of the ten text boxes above. All that each event procedure
does is point to the same subroutine that adds up the contents of all ten
boxes to provide a total. is there some way that I can have just one event
procedure that will serve all ten text boxes instead.
Basically what I'm trying to with all the above is cut down dramatically on
the amount of code and therefore hopefiully make the whole thing more
efficient.
If anyone can point me in the right direction or give me some advice then
I'd be very grateful.
Thanks V much
David.
I wonder if anyone can help me with a couple of problems I'm having with
Access 2000.
Firstly, I have a form and within that a subform that contains 10 text boxes
called weight1, weight2, weight3 and so on up to weight10. On the main form
I have some VB code that checks the contents of all ten boxes. At the moment
I have a seperate piece of code to check each text box when I would much
rather reference each one via a simple for...next loop. I have tried to
accomplish this but never seem to have any luck getting it to work. I know
that if everything resided on the main form it would be an easy task and i
would use some code such as:
for loop1 = 1 to 10
if me("weight"+format$(loop1))=100 then foundbox.visible = true
next
What I can't work out is how change the second line so it will look at each
box on the subform as part of the loop. I understand the principle of
[forms]![my subform]! etc etc but can't work out the correct syntax for
referencing them within a simple loop.
The problem I'm having is that I also have an 'after update' event procedure
against each of the ten text boxes above. All that each event procedure
does is point to the same subroutine that adds up the contents of all ten
boxes to provide a total. is there some way that I can have just one event
procedure that will serve all ten text boxes instead.
Basically what I'm trying to with all the above is cut down dramatically on
the amount of code and therefore hopefiully make the whole thing more
efficient.
If anyone can point me in the right direction or give me some advice then
I'd be very grateful.
Thanks V much
David.