Hi
Thanks for the reply - I've figured that the problem is down to an unbound combo box on the page. If I remove this - then run the duplicate record the record duplicates with or without the code you posted but the value of RiskDate stays the same.
The control is a text box called RiskDate - the control source is RiskDate (date) in table RiskCTRLS.
The code I attached to the command button is:
Private Sub DuplicateRecord_Click()
On Error GoTo Err_DuplicateRecord_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If ctl.Tag = "NC" Then
Me(ctl.RiskDate).Value = Null
End If
End If
Next
Exit_DuplicateRecord_Click
Exit Sub
Err_DuplicateRecord_Click:
MsgBox Err.Description
Resume Exit_DuplicateRecord_Click
End Sub
The value doesn't get set to null - it stays the same. Ideally I'd like this to be today's date ie Now() but I don't seem to be getting this working
Thanks
Main Topics
Browse All Topics





by: capricorn1Posted on 2006-09-19 at 08:32:40ID: 17552863
you can copy all the fields except those two
-place a { C } in the tag property of the fields you need to copy
-or place a { NC } in the tag property of the two fields you don't want to cpy
using the { NC } tag
place this codes below your codes to copy the records
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If ctl.Tag = "NC" Then
Me(ctl.Name).Value = Null
End If
End If
Next