Hi Guys,
Have an Access 365 database running Widows 10 Pro. I have had a problem for many months now and tried many different approaches to solve it with no luck.
This happens on many of my bound forms and it happens sporadically. Sometimes I can add 10 new clients with no issue and then all of a sudden...
"Error 2046 The command or action 'RecordsGotoNew' isn't available now.
Some of the forms have a subform, some do not. Some of the forms have a listbox for navigation, some do not.
Below you can see my code and a couple of the methods I have tried. Both of these methods are run by a button push on the Clients form.
Method 1 is what I currently use and when it fails, I just exit the database and then re-enter and it usually works the next time around.
Method 2 always works, but I can't seem to find a way for it to put me on the newly created record when I am in the form.
'method 1
Me.AllowAdditions = True 'make sure form allows additions
If Me.AllowAdditions = True Then 'double check
DoCmd.RunCommand acCmdRecordsGoToNew
Else
MsgBox "Problem Allow Additions still not True 'make sure allow additions is true"
End If
'method2
Me.AllowAdditions = True 'make sure form allows additions
Set db = CurrentDb
sSQL = "INSERT INTO Clients (CreatedBy, CreatedOn) VALUES ('Ira',#1/1/2022#)"
db.Execute sSQL, dbFailOnError
If db.RecordsAffected = 0 Then
MsgBox "No New records were created by the above query?"
End If
Me.Requery
DoCmd.RunCommand acCmdRecordsGoToLast 'DOES NOT WORK Never gets you to the newly created record
Thank you,
Ira