I am assuming you have an employee table and a related invoice table. If you
don't, you should. Then you need a form with a subform. The form should be
a single record form with the employee table or a query on that table as the
record source. The subform should be based on the invoice table or a query
on that table.
> I am trying to add many new records at once.
>
> What I need is to enter about 25 invoice numbers at once and those
> invoice numbers are linked to one employee. Is this possible? Please
> help. Thank you.
Thanks I will create a subform based on the invoice table. Is i
possible for a user to enter several invoice #'s at once withou
entering one at a time? For instance entering invoice # 22 thru 45
without having to manually enter one at a time, linked to employee Mr
Smith.
Klatuu Wrote:
> I am assuming you have an employee table and a related invoice table.
> If you
[quoted text clipped - 14 lines]
> > --
> > ptlm65Posted from - http://www.officehelp.in
--
ptlm65Posted from - http://www.officehelp.i
Klatuu - 30 Nov 2005 18:51 GMT
Yes, it is possible, but would take some coding to accomplish it. The code
would be in the form, not the sub form. You could provide two text boxes -
one for the from number and one from the to number. The a command button to
add the records. It might go something like this (untested air code):
Dim lngFrom as Long
Dim lngTo as Long
Dim lngCounter as Long
Dim dbf as Database
Dim rst as Recordset
Set dbf = CurrentDb
Set rst = CurrentDb.OpenRecordset("InvoiceTable", dbOpenDynaset)
lngFrom = Me.txtFromNumber
lngTo = Me.txtToNumber
For lngCounter = lngFrom To lngTo
With rst
.AddNew
![Client_Code] = Me.txtClientCode
![Invoice_No- = lngCounter '<- May need to think about data type
here
'If you need to populate other fields and have the data, they
could go here
.Update
End With
Next LngCounter
rst.Close
Set rst = Notihing
Se dbf = Nothing
> Thanks I will create a subform based on the invoice table. Is it
> possible for a user to enter several invoice #'s at once without
[quoted text clipped - 21 lines]
> > > --
> > > ptlm65Posted from - http://www.officehelp.in