add a text box in a form as needed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am coding a form with 5 text boxes in a line. I need to code the form so
that user will see the 6th text box in the same line when he fills in the 5th
box. Is there anyway to code it besides hide the 6th, 7th, 8th boxes?
 
SOS said:
I am coding a form with 5 text boxes in a line. I need to code the form so
that user will see the 6th text box in the same line when he fills in the 5th
box. Is there anyway to code it besides hide the 6th, 7th, 8th boxes?


Just set the 6th, etc text box's Visible property to No in
design view. Then, use the 5th text box's AfterUpdate event
to make the 6th text box visible (or not if text5's value is
erased):
Me.text6.Visible = Not IsNull(Me.text5)
Similarly for the 6th text box's AfterUpdate.

You will probably want to use the form's Current event to
make the appropriate text boxes visible/invisible when you
navigate to a different record:
Me.text6.Visible = Not IsNull(Me.text5)
Me.text7.Visible = Not IsNull(Me.text6)
Me.text8Visible = Not IsNull(Me.tex7)
 
Thanks for your help. I still have question regarding this issue. I put these
text boxes in the detail section on form. I expect to automaticaly create
another row of text boxes when user wants to. How do I make it possible? In
other words, each row of text boxes is a group. Each group can contains 1 to
10 text boxes. User may enter 4 text boxes and wants to go to the 2nd row of
text box and enters 7 text boxes then goes to 3rd row of text boxes....
Another issue is the text box is visible or not. It always need space on the
form. Is there anyway to code so that we won't need space if we don't use it.
Am I ask too much?
Thanks for all the help.
 
SOS said:
Thanks for your help. I still have question regarding this issue. I put these
text boxes in the detail section on form. I expect to automaticaly create
another row of text boxes when user wants to. How do I make it possible? In
other words, each row of text boxes is a group. Each group can contains 1 to
10 text boxes. User may enter 4 text boxes and wants to go to the 2nd row of
text box and enters 7 text boxes then goes to 3rd row of text boxes....
Another issue is the text box is visible or not. It always need space on the
form. Is there anyway to code so that we won't need space if we don't use it.
Am I ask too much?


It sure is getting close to being too much. OTOH, this kind
of UI is indicative of a major flaw in your table design. I
would probably be a far more effective use of your time to
reassess how your data is stored in tables and redo any
parts of it that does not conform to the basic rules
(Normalization) of relational databases.
 
Thanks again. I would like to redo my table but the user said they usually
need 5 fields but sometimes more. I put 10 fields per record. On the form,
users don't want to see all the 10 fields because most of them are blank.
That's why I asked if I can don't creat these text fields if I don't need
them. Any idea?
--
 
SOS said:
Thanks again. I would like to redo my table but the user said they usually
need 5 fields but sometimes more. I put 10 fields per record. On the form,
users don't want to see all the 10 fields because most of them are blank.
That's why I asked if I can don't creat these text fields if I don't need
them. Any idea?


The idea is to use invisible text boxes as I said before.
Creating objects such as fields and controls on the fly is
an unworkable idea.

You are just killing yourself if you continue with this sort
of spreadsheet kind of thing. Trying to simulate groups of
a relatively unknown number of fields all in one table
record is about at the point where the whole idea goes over
the cliff.

I sure would be a lot better if you had these optional
values in a separate table so you could display however many
there are in a continuous subform.
 
Back
Top