Insert New Row on Form

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

Guest

The scenario:

A user is entering phone numbers on a form.

I don't know how many phone numbers the user will want to enter.

I want to be able to have one textbox for the phone number and a button next
to it that, when clicked, automatically creates a new textbox directly below
the first textbox on the form (and shifts everything else below that point
down accordingly) so the user can enter another phone number until all the
phone numbers are entered. (to add a complexity this textbox is actually on a
tab).

Any ideas on how to do this, or something that accomplishes the same task (I
want the user to be able to see all the phone numbers he enters.)

TIA,

B
 
If you have a related item (phone number) and you can have any number of
these items per person, then you have a one-to-many relationship.

The proper way to handle this is to have a separate table with the phone
numbers and a key that relates it back to the main table (customernumber,
employeenumber?)

In your form, you'd have all your main data on the main form and your phone
numbers would be in a subform.
 
b said:
The scenario:

A user is entering phone numbers on a form.

I don't know how many phone numbers the user will want to enter.

I want to be able to have one textbox for the phone number and a button next
to it that, when clicked, automatically creates a new textbox directly below
the first textbox on the form (and shifts everything else below that point
down accordingly) so the user can enter another phone number until all the
phone numbers are entered. (to add a complexity this textbox is actually on a
tab).

Any ideas on how to do this, or something that accomplishes the same task (I
want the user to be able to see all the phone numbers he enters.)

TIA,

B
I saw a simple solution to this age-old problem. I fell in love with it's
simplicity immediately.

All you need on your form is a text box, a command button, and a really long
list box. When the user enters the form, the list box is blank. When he
enters a phone number, he clicks the command button, which is programmed to
add the entry into the list box's row source, as well as any tables you want
to add it to. Requery the list box, and presto, the entry is added on screen
to the bottom of the list box. Set focus to the text box again, and blank it
out. Now it's ready for the next entry.
 
Right, I have my database tables as you've suggested but want a really
user-friendly interface - maybe I don't know enough about subforms but mine
always look pretty much like a table embedded on a form.

That's why I'm hoping there's a way to have a textbox on a form (that
eventually writes to a separate phone number table). I want the user to be
able to click a button and a new textbox opens up and the user can enter
another phone number. At this point these textboxs will only hold the data.
It's not until the user clicks a save button that these get loaded into the
phone number table.

Thanks for any other suggestions...

B
 
K - that sounds pretty slick... but, considering the price of real estate,
I'm going to add a twist to it and try to make the listbox a pop-up box (that
stays on top) so it only appears when additional phone numbers are required.
As the user adds new phone numbers to the textbox and clicks the command
button they'll be reflected in the pop-up listbox.

TFYH

Comments on this approach? Easy for a rookie (like me?)
 
b said:
K - that sounds pretty slick... but, considering the price of real estate,
I'm going to add a twist to it and try to make the listbox a pop-up box (that
stays on top) so it only appears when additional phone numbers are required.
As the user adds new phone numbers to the textbox and clicks the command
button they'll be reflected in the pop-up listbox.

TFYH

Comments on this approach? Easy for a rookie (like me?)
I saw a simple solution to this age-old problem. I fell in love with it's
simplicity immediately.
[quoted text clipped - 6 lines]
to the bottom of the list box. Set focus to the text box again, and blank it
out. Now it's ready for the next entry.
It certainly isn't hard. I only suggested the way I did because that way the
data is immediately displayed. If something's wrong with it you know what you
need to do.
 
b said:
Right, I have my database tables as you've suggested but want a really
user-friendly interface - maybe I don't know enough about subforms
but mine always look pretty much like a table embedded on a form.

Use a continous form instead of a datasheet. Then you can make it look pretty
much like you want.
 
b said:
Do you happen to have an example of this in code that you could post?
All you need on your form is a text box, a command button, and a really long
list box. When the user enters the form, the list box is blank. When he
[quoted text clipped - 3 lines]
to the bottom of the list box. Set focus to the text box again, and blank it
out. Now it's ready for the next entry.
I'm sorry, I deleted it a long time ago. Why don't you try it, though. It's a
good exercize in a small program.
 
Thanks anyway - I was just hoping to save myself some time. I've been
working on it all afternoon! If only my coding skills were as good as my
nunchak skills...
 
Back
Top