By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,466 Members | 1,149 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,466 IT Pros & Developers. It's quick & easy.

Auto Generate New Records

P: n/a
I need to figure out a way to have a form add new records to a table
based on a user defined qty and the last number used in the table for a
specific part number.

Let me explain better... i have table with part numbers for a product.
Each part number has a Serial Number starting with 0001 then 0002
etc...

What i would like to happen is when an employee comes to a part number
that they can automatically create 10 new records of Serial Numbers by
putting a qty into a text box. The database would evaulate the part
number field and then go and match that to the table to see where the
last Serial Number ended. It would then create 10 new serial numbers
starting with one more than the last serial number for that part.

How hard is this... i don't feel like i explained it very well but lets
see.

thanks,
KO

Sep 28 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
So either on lose focus or on a command button click event you would put air
code like
....
dim rst as dao.recordset,db as database,a as long
set mydb=currentdb()
set rst=mydb.openrecordset("tablename",dbopendynaset)
a=dmax("[serial#]","[parts table]","[part #]=" & forms![yourform]![part#])
While a>a+forms![yourform]![qty]
a=a+1
with rst
..addnew
![part#]=forms![yourform]![part#]
![serial#]=forms![yourform]![qty]
..update
end with
wend
close
forms![myform].requery ' to show new records
....

HTH
Martin
"turtle" <ko****@vistacontrols.comwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
I need to figure out a way to have a form add new records to a table
based on a user defined qty and the last number used in the table for a
specific part number.

Let me explain better... i have table with part numbers for a product.
Each part number has a Serial Number starting with 0001 then 0002
etc...

What i would like to happen is when an employee comes to a part number
that they can automatically create 10 new records of Serial Numbers by
putting a qty into a text box. The database would evaulate the part
number field and then go and match that to the table to see where the
last Serial Number ended. It would then create 10 new serial numbers
starting with one more than the last serial number for that part.

How hard is this... i don't feel like i explained it very well but lets
see.

thanks,
KO



----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Sep 28 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.