Selecting more than one control using Visual Basic in Access

  • Thread starter Thread starter Malogant
  • Start date Start date
M

Malogant

I am unable to figure out how to write a program in VB to
select more than one control (multiple Text boxes in
particular) on a form in Access. Any hints or solutions
would be appreciated
 
What do you mean by "select more than one control"? What is it you're trying
to do?
 
-----Original Message-----
I am unable to figure out how to write a program in VB to
select more than one control (multiple Text boxes in
particular) on a form in Access. Any hints or solutions
would be appreciated
.
Malogant:

What do you mean with select more than one control?
1. to select the value of each control?
2. to phisically select the controls?

In both case you must do a loop to check the controls.
for the first case you will need to use an array, type
structure, variables or whatever you want to store the
values.
Private sub getValues()
Dim ctl as control <-- beter if you set to the
appropiated type of control
dim i as byte <-- because you wont have more than 255
controls on the form... do you?

For each ctl in Me.controls
if ctl.controltype = acTextbox txtbox then
i = i +1
publicarray(i) = ctl.controlype.value
end if
next ctl

End sub

I can't figure out what would you do if what you want is
the second option (unless to change colors, backgounds
etc. at run time)???

The procedure is the same, just the public variable will
chang from array to object.

good luck


Estuardo
 
Back
Top