Thanks for the responses :
James.
I've changed the
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
to
docmd.runcommand accmdundo
me.refresh
as you suggested but this has not made any difference.
I've also set the focus to a control on the mainmenu form, after setting the focus to the form.(just setting the focus to the control didn't work at all)
Michael.
To cover your points/questions - The form MainMenu is, as the name implies, the opening form for the database.
RequestsForm is opened from a control button on MainMenu, MainMenu remains loaded.
AS MainMenu remains loaded I think declaring the variable in the form is OK.
The OnLoad event for MainMenu sets the variable to False as this is the default value I want for it. Granted this bit of code may well be redundant as I set it to True or False in the OnCurrent event of RequestsForm.
The DoCmd.Close you refer to is from my first attempt at this - when I was trying to close RequestsFrom from itself. It also didn't work when I was more explicit and specified the form name though.
There is indeed a required field on the form, [ReqDate], it is this control I check to see whether or not to delete (undo) the record.
To summarise the current situation.
MainMenu loads.Declares IsFirstNewRec as public variable.
Clicking on the relevant Control Button loads the RequestsForm form.
Hitting Enter on the first field (ReqDate) results in a message saying "no data entered - deleting record"
The 2 setfocus commands then trigger.
The Activate event for MainMenu triggers (I have a message box in here so I can see what is going on).
And then I get the error message!
If I comment out the lines that try to close the form then MainMenu appears over the top of the REquestsForm so I know the SetFocus works.
Heres the relevant Code:
MainMenu
--------
Option Compare Database
Option Explicit
Public IsFirstNewRec As Boolean
Private Sub Form_Activate()
MsgBox "activate"
If IsFirstNewRec Then
DoCmd.Close acForm, "requestsform"
End If
End Sub
Private Sub Form_Load()
IsFirstNewRec = False
End Sub
RequestsForm
------------
Private Sub Form_Current()
Dim FrmFirst As String
Dim FrmLast As String
Dim db As Database
Dim rst As Recordset
Dim resp As Boolean
resp = UpdSubs()
'MsgBox Forms.Item("mainmenu"

.IsFirstNewRec
Set db = CurrentDb
Set rst = db.OpenRecordset("BaseQuery"
' Check which navigation controls should be active
If rst.EOF Then
Me.GotoNext.Enabled = False
Me.GotoPrev.Enabled = False
Me.GotoLast.Enabled = False
Forms.Item("mainmenu"

.IsFirstNewRec = True
AddNew_Click
Else
Forms.Item("mainmenu"

.IsFirstNewRec = False
rst.MoveFirst
FrmFirst = rst!ReqID
Do Until rst.EOF
FrmLast = rst!ReqID
rst.MoveNext
Loop
rst.Close
Me.GotoNext.Enabled = True
Me.GotoPrev.Enabled = True
If Me.ReqID = FrmFirst Then
Me!GotoPrev.Enabled = False
End If
If Me.ReqID = FrmLast Then
Me!GotoNext.Enabled = False
End If
End If
Private Sub ReqDate_LostFocus()
If IsNull(Me.ReqDate) Then
MsgBox ("no data entered - deleting record"

Dim db As Database
Dim rst As Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("nextreq"

rst.MoveFirst
rst.Edit
rst!nextrequest = rst!nextrequest - 1
rst.Update
rst.Close
Set db = Nothing
'DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.RunCommand acCmdUndo
Me.Refresh
If Forms.Item("mainmenu"

.IsFirstNewRec Then
MsgBox "setting focus back to mainmenu"
Forms![MainMenu].SetFocus
Forms![MainMenu]!OpenRequestForm.SetFocus
Exit Sub
End If
Else
Me.TabCtl0.Enabled = True
Me.PAtName.Enabled = True
Me.Request_Details.SetFocus
Me.PAtName.SetFocus
End If
End Sub
Pheww!! Hope you haven't lost interest because this is so long!
Any other ideas ???
Thanks very much,
JaneC