LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default form inside a loop

I have a form that includes a number of inputs (we'll call it (name)
frmPO). The user inputs the information from a purchase order (i.e.
company name, address, etc.) into frmPO. One of the text boxes (i.e.
(name) txtPOItems) on frmPO includes an input for the number of items
included in the purchase order.

More than simply entering the number of items, I want the user to be
able to enter the description of the item. I'm getting hung up on
coding something that will allow the user to input the item
description according to the number of items (whether 2 items or 15
items, etc.).

Let me try to illustrate. I'll use the number 3 (i.e.
frmPO.txtPOItems.Value is 3). Initially I thought that when the user
submits the purchase order items (i.e. clicks a command button (name)
cmdEnterItems) the event would trigger another form (i.e.
frmItems.Show) that would allow the user to enter item 1 description
into a text box (i.e txtItems). Upon submitting frmItems (i.e. clicks
the command button (name) cmdSubmitItem) the frmItems would appear
again, the user would enter item 2 description into the text box
(txtItem), submit the form (cmdSubmitItem), frmItems would reappear,
and the user would enter item 3 description (and so on for any number
of items). After entering the 3 items, the user would finish filling
out frmPO and then submit the form. Hopefully this makes sense.

I have written the code below, but when frmAddItem.Show executes I
don't know how to then create the event on frmAddItem such that it
will remember what number in the loop it's on to retain the
appropriate txtItem.Value (which I thought I could do with an array
for outputting purposes in the spreadsheet).

Private Sub cmdEnterItems_Click()
Dim a

For a = 1 To frmPO.txtPOItems.Value
frmAddItem.Show

Next
End Sub

What to do here?

Private Sub cmdSubmitItem_Click()
'I'm not sure what to do here. Maybe somehow pass the txtItem back
to the above procedure
'such that it is received inside the For Loop?
End Sub

Any help is greatly appreciated as I learn more about user forms and
programming in general. Thanks in advance.

Matt

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
use time functions inside if loop saedeepu Excel Worksheet Functions 2 September 17th 09 12:55 PM
Increment stopvalue inside a For loop Revenger Excel Programming 2 May 26th 06 09:17 AM
Loop inside a Loop jhahes[_52_] Excel Programming 6 April 7th 06 07:23 PM
Create an array inside a For...Next loop Eric Winegarner[_2_] Excel Programming 3 October 27th 05 12:26 AM
Placing a form inside of a form pjw Excel Programming 4 June 17th 05 07:08 AM


All times are GMT +1. The time now is 08:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"