Hi, I have this code that duplicates my reccord.
Code:
Private Sub btnDuplicateRecord_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 Errhandler
' Tag property to be used later by the append query.
Me.Tag = Me![ID]
' Add new record to end of Recordset object.
With Rst
.AddNew
!Priorities = Me!Priorities
!Followup = Me!Followup
!Client = Me!Client
!BranchInfo = Me!BranchInfo
!Company_Name = Me!CompanyInfo_ID
!Contact_Person = Me!ContactPerson
!Position = Me!PositionInfo_ID
!Status = Me!Status
!Telephone = Me!Telephone
!Fax = Me!Fax
!Website = Me!Website
!Category = Me!CatergoryInfo_ID
!City = Me!City
!Zipcode = Me!Zipcode
!Address = Me!Address
!Country = Me!CountryInfo_ID
.Update ' Save changes.
.Move 0, .LastModified
End With
Me.Bookmark = Rst.Bookmark
'Requery the subform to display the newly appended records.
Forms!frmMain.Form.Requery
Exit Sub
Errhandler:
TSCs_ReportUnexpectedError "btnDuplicateRecord_Click", Me.Name, "Crash Reporter"
Resume Next
Some of the record that I add using the ms access, when i try to duplicate has no errors, but i think this record is from excel that i just imported to my ms access is giving me error about zero length.
Or if you have a workaround like if the field is null it will skip that field.
I received this ERROR
Error 3315 has occured in procedure [btnDuplicateRecord_Click] in module [frmUpdate]
Field 'Master_FILE.Position' cannot be a zero-length string.