Solved Records go to new isn't available (1 Viewer)

Atthe

Member
Local time
Today, 06:45
Joined
Oct 26, 2021
Messages
57
Evening All,

I have an issue when I run some VBA code that only happens in a certain order. When i run

Code:
Application.RunCommand acCmdDeleteRecord

this deletes the record as expected however the problem I have is after this if I try and run

Code:
 Me.ID.Enabled = True
    Me.Location.Enabled = True
    Me.cmbMachine.Enabled = True
    Me.cmbToolType.Enabled = True
    Me.PartNumber.Enabled = True
    Me.DrawingNumber.Enabled = True
    Me.CALNumber.Enabled = True
    Me.cmbToolCondition.Enabled = True
    Me.cmbLine.Enabled = True
    Me.SAPNumber.Enabled = True
    Me.Notes.Enabled = True

    Me.focustxt.SetFocus

    Me.New_Tooling.Visible = False
    Me.DeleteTooling.Visible = False
    Me.EditTooling.Visible = False
    Me.SearchTooling.Visible = False
    Me.back.Visible = False

    Me.SaveTooling.Visible = True

    Application.RunCommand acCmdRecordsGoToNew
    
    Me.[TCN Number] = DMax("[TCN Number]", "tbltools") + 1
    
    Me.ID.Enabled = False

    Me.Location.SetFocus

I get the error as per title of this thread?

Can anyone help as the code works in all situations apart from this one?

Thanks
 

June7

AWF VIP
Local time
Yesterday, 21:45
Joined
Mar 9, 2014
Messages
5,470
I tested this and works unless I delete the last record because once it is deleted, already on new record.

Test if already new record row.

If Not Me.NewRecord Then DoCmd.RunCommand acCmdRecordsGoToNew
 

Users who are viewing this thread

Top Bottom