Hi
Sorry for not getting back to you sooner.
I noticed that you are adding and deleteing the new reocrd at the same time
so you will never be able to go to it unless you cancel the operation ??
(which is what seem to be happening.
If Me.ReportDtID = 1 Then
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End If
DoCmd.GoToRecord , , acNewRec
eg. If something abc then delete - then add a new XXX
Also
I don't really understand all this
If Me.ReportDtID = 1 Then
Me![Photo] = "none"
Me![Page] = 999999999
Me.Undo
Especially this
Me.Undo
But as I can' see your DB you know best ?
I would step through the code o see what is doing the mischeaf. Like this
Cut out all the bits you don't really need like this
Private Sub btnAddNew_Click()
ProjID.SetFocus
If Me.ReportDtID = 1 Then
Me![Photo] = "none"
Me![Page] = 999999999
Me.Undo
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Else
DoCmd.GoToRecord , , acNewRec
End If
End Sub
Then see if this makes things OK. If not then cut out line by line. You
never know.
Hope this helps
--
Wayne
Manchester, England.
deb said:
Private Sub btnAddNew_Click()
On Error GoTo Err_btnAddNew_Click
Me.AllowEdits = True
Me.AllowAdditions = True
ProjID.SetFocus
DoCmd.SetWarnings False
' if current record report date is 1 then delete
If Me.ReportDtID = 1 Then
Me![Photo] = "none"
Me![Page] = 999999999
Me.Undo
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End If
DoCmd.SetWarnings True
DoCmd.GoToRecord , , acNewRec
Exit_btnAddNew_Click:
Exit Sub
Err_btnAddNew_Click:
MsgBox Err.Description
Resume Exit_btnAddNew_Click
--
deb
Wayne-I-M said:
Can you post the code behind the button you use to add new records