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

Is there a way to copy a record more than once from a form?

P: 24
Hi All,

I'm farely new with access so this question may seem really simple. I have an existing inventory database that I'm trying to make changes to. The database only has 1 table with the following fields:

PartNumber
ItemDescription
Category
Location
Owner
SerialNumber.

Currently I'm using the copy button to add similar items but this just adds one record per click. This is not really efficient if I have to add 300 disk drives. Is there a way where I can prompt the user to ask how many he/she would like to copy?

Or

Could I have a 'Quantity' text box on the form that will input the number of records that equal the quantity. (So if quantity = 5, the database would enter 5 records).?

The database currently does not have a quantity field. It counts items by the number of records.

Thanks,

Kevin
Sep 10 '08 #1
Share this Question
Share on Google+
4 Replies


missinglinq
Expert 2.5K+
P: 3,532
If you're entering serial numbers for each piece of equipment you wouldn't want a "quantity" field on your records, would you? You'd only want to calculate totals, apprently the way you're already doing.

Place an unbound textbox, call it NumberCopies.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdMultiCopy_Click()
  2. Dim Copies as Integer
  3.  
  4. If Me.Dirty Then Me.Dirty = False
  5.  
  6. If Not IsNull(Me.NumberCopies) then
  7.   Copies = Me.NumberCopies
  8. Else
  9. Copies = 1
  10. End If
  11.  
  12. For I = 1 To Copies
  13.   DoCmd.RunCommand acCmdSelectRecord
  14.   DoCmd.RunCommand acCmdCopy
  15.   DoCmd.GoToRecord , , acNewRec
  16.   DoCmd.RunCommand acCmdPaste
  17. Next I
  18.  
  19. End Sub
If the user enters a number into NumberCopies, that many copies will be generated. If they don't enter a number, the default is one copy.

Welcome to Bytes

Linq ;0)>!
Sep 10 '08 #2

P: 24
Hi Linq,

Thanks for the quick reply. I'm having a little trouble on getting the code right. I created the unbound text box in my form and called it NumberCopies. However when I go to put the code in I select 'NumberCopies' from the left pull down and the right pull down defaults to 'BeforeUpdate'. The code looks like this:

Private Sub NumberCopies_BeforeUpdate(Cancel As Integer)

End Sub

When I put your code in it the left drop down is set to 'General and the right pull down is set to 'cmdMultiCopy_Click.'

Thanks,

Kevin
Sep 10 '08 #3

P: 24
Linq,

Nevermind....I was being a Newbie...Thanks for the code it works great.

Kevin

=)
Sep 11 '08 #4

missinglinq
Expert 2.5K+
P: 3,532
Glad we could help!

Linq ;0)>
Sep 11 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.