Question About Clone, Duplicate Records (1 Viewer)

vdanelia

Registered User.
Local time
Today, 07:09
Joined
Jan 29, 2011
Messages
215
Hello!
Having a form command button on it, being clicked it duplicates, clones the current record, everything is OK
Now Question:
If I want to have 10 identical records then I have to click on It 10 times, is there any solution to specify a number of clones, duplications (for example If I create near the button a text-box or combo where I could specify number of clones, duplications)

Greatest Thanks
 
Last edited:

r.harrison

It'll be fine (I think!)
Local time
Today, 15:09
Joined
Oct 4, 2011
Messages
134
Hi,

Yes, adding a textbox next to the button where you can input the amount of times to duplicate it will work.

I am curious though, why do you want duplicated records?
 

vdanelia

Registered User.
Local time
Today, 07:09
Joined
Jan 29, 2011
Messages
215
Hi r.harrison
How to accomplish that task... I thought about it, but can't figured out....
 

r.harrison

It'll be fine (I think!)
Local time
Today, 15:09
Joined
Oct 4, 2011
Messages
134
On your form, create a text box called txt_count

On the OnClick event for the button you need to create a for...next loop.

For i = 1 to me.txt_Count

(YOUR CODE TO CREATE DUPLICATES GOES HERE)

Next i
 

vdanelia

Registered User.
Local time
Today, 07:09
Joined
Jan 29, 2011
Messages
215
r.harrison
Thanks for the reply but Button has embedded macro not VBA, From macro Couldn't manage it
 

r.harrison

It'll be fine (I think!)
Local time
Today, 15:09
Joined
Oct 4, 2011
Messages
134
I think you'll need to do this in VBA as I'm not sure how to for...next in a macro.

There should be an option to convert Macro's to VBA. What version of Access are you running?
 

vdanelia

Registered User.
Local time
Today, 07:09
Joined
Jan 29, 2011
Messages
215
I did but gave me an Error:

For i = 1 To Me.txt_Count
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70
Next i

Says: Variable not Defined, Then I Added: Dim i As Integer
No error, but not duplicates entered number
 
Last edited:

r.harrison

It'll be fine (I think!)
Local time
Today, 15:09
Joined
Oct 4, 2011
Messages
134
Easiest way around this is to do an INSERT statement:

If you send me a sample of your table I'll have a look at it and talk you through what you need to do.
 

r.harrison

It'll be fine (I think!)
Local time
Today, 15:09
Joined
Oct 4, 2011
Messages
134
Theoretically yes the code should repeat itself the number of times in the textbox, but i'm not too familiar with the
acEditMenu
commands.

an INSERT INTO command is really what you are looking for.

Still not too sure why you want to duplicate records though.

The idea of databases is to reduce the amount of information you need to store. Linking tables is more likely to be the solution to your problem.

Could you explain what it is you are trying to achieve?

At least then I may be able to help you toward a more suitable solution.
 

vdanelia

Registered User.
Local time
Today, 07:09
Joined
Jan 29, 2011
Messages
215
Thanks for the Suggestions r.harrison
I'll Explain Why I needed it....
In one office a person who did the inventory (Office Products and PC Components) gave me the database .. it is old fashioned, and it is not normalized... I must build new Normalized One. before I'll Build new one that function needed there.
There are Fields:
Dealer - A company from was the product bought,
Product - What product it was (Scanner, Printer, notebook and so on)
Model -
SN- Serial Number
BCODE- Barcode
RespPerson - A person who is the responsible for the product
Location - Where the product is Located
UnitPrice - A product Price
TotalPrice - Sum
Of course there are many other fields too
______
In this database if there is 10 Printer it is registered 10 times, (I asked why? in such way) I was answered that every product is unic (and they have different barcodes, serial numbers and each of them have different Responsible person).
 

r.harrison

It'll be fine (I think!)
Local time
Today, 15:09
Joined
Oct 4, 2011
Messages
134
Just a couple of ideas for you

There are Fields:
Dealer - A company from was the product bought,
Product - What product it was (Scanner, Printer, notebook and so on)
Model -
SN- Serial Number
BCODE- Barcode
RespPerson - A person who is the responsible for the product
Location - Where the product is Located
UnitPrice - A product Price
TotalPrice - Sum
Of course there are many other fields too
Dealer If you use specific dealers then you could add a dealers table. This could be a linked ID to the dealers table.

Product Again if you buy specific products, or have an itemised list of company products this could also be linked.

RespPerson Would link to a Employees table.

Location Another table with a list if office locations.

TotalPrice is a calculated field and belongs in a query, not a table.

Just reading this post makes me think it's a hard job, but normalization of your DB is really important to make it work effectively.

Good luck!
 

vdanelia

Registered User.
Local time
Today, 07:09
Joined
Jan 29, 2011
Messages
215
At first I deleted all the forms, converted db file from 2003 to 2010 Normalized the tables, Linked them: Dealer, Product, Brand, ResPerson, Location and other tables which is not here listed... In Access Analise Performance Everything is Ok

I was thinking how to overcome the duplicated values (Products), but I think I can't, because Many Fields are Unic and are with different values such as, bar-code, Serial, ResPersons.
Thank you very much for Suggestion.....
 

r.harrison

It'll be fine (I think!)
Local time
Today, 15:09
Joined
Oct 4, 2011
Messages
134
Without data it's impossible to give a solution, but I would assume that the serial field would be a unique field so with a create table query you could make a new table with all the products in it.

Again, only a theoretical solution as I have no insight to the current format of your DB.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom