Entering multiple identical orders with sequential numbers (1 Viewer)

vangogh228

Registered User.
Local time
Today, 07:42
Joined
Apr 19, 2002
Messages
302
Hello all.

I need to be able to enter a number of orders that would all be the same, but they will have different order numbers, in sequence.

I'd like to enter all the information in a form, then have "First Order Number" and "How Many?" fields, and have the system grab the detail, apply it to the order number entered, create a record in the table, then reapply the detail to the next sequential number, repeating the process until it has created the number of orders shown in the "How Many?" field.

I am at a total loss here, and any help would be GREATLY APPRECIATED!!

Thanks!

Tom
 

vangogh228

Registered User.
Local time
Today, 07:42
Joined
Apr 19, 2002
Messages
302
Any help will be greatly appreciated. I'm sure I'm not the first to encounter this, so any ideas are welcome. Thank you!
 

KeithG

AWF VIP
Local time
Today, 04:42
Joined
Mar 23, 2006
Messages
2,592
Do you know VBA? You are going to have open the recordset and loop through a procedure to add the new record for the number of records you need. You can use an AutoNumber field for your key.
 

CraigDolphin

GrumpyOldMan in Training
Local time
Today, 04:42
Joined
Dec 21, 2005
Messages
1,582
This is not /exactly/ what you're after but it could provide the basis for you to code a procedure.

I do something similar in my salmon database where many details about individual salmon are the same from one record to the next (within a survey). To save time, I use a command button to add new records to my fish table (which my form is bound to) and echo the values from the previous entry for all of the controls on a form that are likely to be repeated.

In your case, all the controls except for your order number and quantity would be echoed. Use the update event for each control on the form to set the tag property for that control to the value you entered. Then in the on_click event of the 'add new order' button on your form, after the line of code that creates a new record, set the value for each control to the tag property value. However, make sure to check to see that the control value is null before setting the value.

Here's the code I use to echo the species field value for a combobox called "Species" on a form which is bound to my fish table.

Code:
Private Sub Species_AfterUpdate()
Me.Species.Tag = Me.Species
End Sub

Code:
Private Sub Command55_Click()
On Error GoTo Err_Command55_Click


    DoCmd.GoToRecord , , acNewRec
    If Me.Species & "" = "" Then
        If Me.Species.Tag & "" <> "" Then Me.Species = Me.Species.Tag
    End If
Exit_Command55_Click:
    Exit Sub

Err_Command55_Click:
    MsgBox Err.Description
    Resume Exit_Command55_Click
    
End Sub
 
Last edited:

Users who are viewing this thread

Top Bottom