Dublicating Parent and Relating Forms

MoleY

Registered User.
Local time
Today, 15:37
Joined
Nov 16, 2009
Messages
12
Good Afternoon,
I'm currently undertaking a database and I've finally got to point of needed assitance!

I basically need to dublicate a Record on a form (Which I can do) but the bit i can't do is to dublicate a child form that links to this form.

Here is my database layout I have:
PRC_Partslist
>Subform< -PRC entry (This is the record I dublicate)
Which consists of
-PRC_Number (autonumber)
-Part Number
-Description etc etc...

Now I have a form related to this which called Procedures (This is the one I'm having problems with)
and this consists of
-Prc_Number(Number) [table linked together via this field]
-Op Number
-Op Name
-Name etc etc

The operation of the database is as follows,
A part number is searched for and then a PRC is added to that number. Everytime a product is manufactured, it is given a PRC number, and then a list processes is given to state what process the part undergoes when being manufactured... engraving, laser cut etc. (allowing us to control the manufacture process)

Now fast forward a 2months time and we want to manufacture the part again, we will need to give it a new PRC number, but everything else will be exactly the same, so i've made a dublicate button by following this guide
http://support.microsoft.com/?kbid=208824
but i can't it to update my procedures form, i'm guessing as its because its not actually a subform.

Everytime I dublicate the record and the procedures record, it adds another PRC record under the part number, which works well as it issues a new prc number etc, but intead of copy the procedures to the new PRC number, it just appends them to orignal PRC.

I appologise if this is long winded, but I've tried to be as thorough as possible!

Anyhelp will be very much appreciated!

Regards
Stuart
 
but i can't it to update my procedures form, i'm guessing as its because its not actually a subform.
Since it is running an append query using the tables, it does not care if you are using a sub form or a pop-up form


Since we can not see all the code used, it will be very difficult for us to be able to spot any issues.

Will you post your VBA code?
 
Good Morning,
Here is the code i've used for my button:

Private Sub btnDuplicate___Click()
Dim dbs As DAO.Database, Rst As DAO.Recordset
Dim F As Form
' Return Database variable pointing to current database.
Set dbs = CurrentDb
Set Rst = Me.RecordsetClone
On Error GoTo Err_btnDuplicate_Click
' Tag property to be used later by the append query.
Me.Tag = Me![PRC_Number]
' Add new record to end of Recordset object.
With Rst
.AddNew
!Part_Number = Me!Part_Number
!Description = Me!Description
!Material = Me!Material
!Issue = Me!Issue
!Spec = Me!Spec
!ItemsMaterials_Description = Me!ItemsMaterials_Description
!ItemsMaterials_Batch_No = Me!ItemsMaterials_Batch_No
!ItemsMaterials_Qty_Issued = Me!ItemsMaterials_Qty_Issued
!Qty_Required = Me!Qty_Required
!Date_Required = Me!Date_Required
!MRC_No = Me!MRC_No
!Name = Me!Name
.Update ' Save changes.
.Move 0, .LastModified
End With
Me.Bookmark = Rst.Bookmark
' Run the Duplicate Order Details append query which selects all
' detail records that have the OrderID stored in the form's
' Tag property and appends them back to the detail table with
' the OrderID of the duplicated main form record.
DoCmd.SetWarnings False
DoCmd.OpenQuery "Duplicate Order Details"
DoCmd.SetWarnings True
'Requery the subform to display the newly appended records.
Exit_btnduplicate_Click:
Exit Sub
Err_btnDuplicate_Click:
MsgBox Error$
Resume Exit_btnduplicate_Click:
End Sub

I'm really not sure what to do in relation to my append query.

Cheers
Stuart
 
The code appears to be just like the example you provided a link to.

It may be something in the query "Duplicate Order Details" since that is the part that is not working.

Will you post the SQL for the query "Duplicate Order Details"?
 
Good Afternoon,
I've solved the problem now, so thankyou for your time!
 

Users who are viewing this thread

Back
Top Bottom