I have a form with a button that copies data on main form and sub forms and enters this into the tables. I used the instructions from the link below and it works great!!
http://support.microsoft.com/kb/208824
Now the problem...
When I drag the form into a form with a tab it bombs when it tries to find the form. It is asking for a parameter value for ..Forms!f2CustImpactsEdit!CustImpactID. I thik the problem starts at the tag property...Me.Tag = Me![CustImpactID] line of code.
Is there a way to fix this???
Here is my code
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![CustImpactID]
' Add new record to end of Recordset object.
With Rst
.AddNew
!KPIProjID = Me.KPIProjID
!KPIPMID = Me.KPIPMID
!ReportDtID = Me.ReportDtID
!Scope = Me.Scope
!Invoicing = Me.Invoicing
!SWDeliv = Me.SWDeliv
!HWDeliv = Me.HWDeliv
!Payments = Me.Payments
!MoMtgHeld = Me.MoMtgHeld
!Outage = Me.Outage
!OutagePlan = Me.OutagePlan
!ExWorks = Me.ExWorks
.Update ' Save changes.
.Move 0, .LastModified
End With
Me.Bookmark = Rst.Bookmark
' Run the Duplicate Details append query which selects all
' detail records that have the CustImpactID stored in the form's
' Tag property and appends them back to the detail table with
' the CustImpactID of the duplicated main form record.
DoCmd.SetWarnings False
DoCmd.OpenQuery "q2CustImpactsDupe"
DoCmd.SetWarnings True
'Requery the subform to display the newly appended records.
Me![f2CustImpactsEditDetails].Requery
RetValue = MsgBox("Reminder!! Change the Report Date and other data before clicking the Save button.", vbOKOnly)
Exit_btnduplicate_Click:
Exit Sub
Err_btnDuplicate_Click:
MsgBox Error$
Resume Exit_btnduplicate_Click:
End Sub
http://support.microsoft.com/kb/208824
Now the problem...
When I drag the form into a form with a tab it bombs when it tries to find the form. It is asking for a parameter value for ..Forms!f2CustImpactsEdit!CustImpactID. I thik the problem starts at the tag property...Me.Tag = Me![CustImpactID] line of code.
Is there a way to fix this???
Here is my code
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![CustImpactID]
' Add new record to end of Recordset object.
With Rst
.AddNew
!KPIProjID = Me.KPIProjID
!KPIPMID = Me.KPIPMID
!ReportDtID = Me.ReportDtID
!Scope = Me.Scope
!Invoicing = Me.Invoicing
!SWDeliv = Me.SWDeliv
!HWDeliv = Me.HWDeliv
!Payments = Me.Payments
!MoMtgHeld = Me.MoMtgHeld
!Outage = Me.Outage
!OutagePlan = Me.OutagePlan
!ExWorks = Me.ExWorks
.Update ' Save changes.
.Move 0, .LastModified
End With
Me.Bookmark = Rst.Bookmark
' Run the Duplicate Details append query which selects all
' detail records that have the CustImpactID stored in the form's
' Tag property and appends them back to the detail table with
' the CustImpactID of the duplicated main form record.
DoCmd.SetWarnings False
DoCmd.OpenQuery "q2CustImpactsDupe"
DoCmd.SetWarnings True
'Requery the subform to display the newly appended records.
Me![f2CustImpactsEditDetails].Requery
RetValue = MsgBox("Reminder!! Change the Report Date and other data before clicking the Save button.", vbOKOnly)
Exit_btnduplicate_Click:
Exit Sub
Err_btnDuplicate_Click:
MsgBox Error$
Resume Exit_btnduplicate_Click:
End Sub