473,473 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

24 New Member
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
4 1402
missinglinq
3,532 Recognized Expert Specialist
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
busterbaxter
24 New Member
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
busterbaxter
24 New Member
Linq,

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

Kevin

=)
Sep 11 '08 #4
missinglinq
3,532 Recognized Expert Specialist
Glad we could help!

Linq ;0)>
Sep 11 '08 #5

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

Similar topics

17
by: Danny J. Lesandrini | last post by:
The following code works with a standard MDB to navigate to a particluar record (with a DAO recordset, of course) but it's giving me problems in an ADP I'm working on. Dim rs As ADODB.Recordset...
0
by: misscrf | last post by:
I am currently working on a database, in 3rd normal form, which is for candidates who apply for a job with the law firm that I workd for. My issue is with good form design. I have a main...
3
by: david | last post by:
Hi, I've been reading tons of posts on how to copy records, but to no avail....i'm still stuck. There are three tables: Main, Sub-Form1 & Sub-Form2 I have a form which displays some data....
19
by: davidgordon | last post by:
Hi, I need some pointers/help on how to do the following if it possible: In my access db, I have the following: Tables: Products, Sub-Assembly, Product-Pack Table, Products
2
by: josephm | last post by:
Hello Group: My first post on the group.Hope I get a response. I have a modest Fire Insurance ACCES Db.Thanks to this group - for the code. A "wanna be programmer"... "LEARNS" The code...
7
by: john | last post by:
In my form I have a master table and a details table linked 1xM. I can search through the whole parent table but I also like to be able to search through the child table fields to find parent...
5
by: mbatestblrock | last post by:
I was wondering if it were possible to do this. I have a form that is used to input a ton of information and then I have a button on it it to export it into a word template to print out. Now I...
25
by: tekctrl | last post by:
Anyone: I have a simple MSAccess DB which was created from an old ASCII flatfile. It works fine except for something that just started happening. I'll enter info in a record, save the record,...
1
by: javediq143 | last post by:
Hi All, This is my first post in this forum. I'm developing a CMS for my latest website. This CMS is also in PhP & MySQL. I'm done with the ADD section where the Admin can INSERT new records in...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.