J
John B
Dear All,
I am trying to duplicate a main form and its subform Detail records.
The subform detail record are duplicate in a correct way, but some field of
the main record not.
In particolar the field
!Mittente=Me!Mittente when added generate an error message like "run.time
error 438". And at this point I don't know what to do.
Many thanks for your help and your time. Regards
Giovanni
Private Sub btnDuplicate_Click()
Dim dbs As Database, Rst As Recordset
Dim F As Form
Set dbs = CurrentDb
Set Rst = Me.RecordsetClone
'On Error GoTo ErrorHandler
Me.Tag = Me![ProformaID]
With Rst
.AddNew
!Data = Me!Data
!Cliente = Me!Cliente
!Nazione = Me!Nazione
!Department = Me!Department
!Mittente = Me!Mittente
.Update
.Move 0, .LastModified
End With
Me.Bookmark = Rst.Bookmark
DoCmd.SetWarnings False
DoCmd.OpenQuery "Duplica Spedizione"
DoCmd.SetWarnings True
Me![Spedizione].Requery
SubExit:
Exit Sub
'ErrorHandler:
'MsgBox "The are no record to duplicate.", vbExclamation
'Resume SubExit
I am trying to duplicate a main form and its subform Detail records.
The subform detail record are duplicate in a correct way, but some field of
the main record not.
In particolar the field
!Mittente=Me!Mittente when added generate an error message like "run.time
error 438". And at this point I don't know what to do.
Many thanks for your help and your time. Regards
Giovanni
Private Sub btnDuplicate_Click()
Dim dbs As Database, Rst As Recordset
Dim F As Form
Set dbs = CurrentDb
Set Rst = Me.RecordsetClone
'On Error GoTo ErrorHandler
Me.Tag = Me![ProformaID]
With Rst
.AddNew
!Data = Me!Data
!Cliente = Me!Cliente
!Nazione = Me!Nazione
!Department = Me!Department
!Mittente = Me!Mittente
.Update
.Move 0, .LastModified
End With
Me.Bookmark = Rst.Bookmark
DoCmd.SetWarnings False
DoCmd.OpenQuery "Duplica Spedizione"
DoCmd.SetWarnings True
Me![Spedizione].Requery
SubExit:
Exit Sub
'ErrorHandler:
'MsgBox "The are no record to duplicate.", vbExclamation
'Resume SubExit