I'm posting this in case it might help someone else tracking down weird 2046 errors, which there seem to be a lot of.
I was getting an error 2046 at the lines
As the code worked fine at one site, but failed at another, I suspected a backend problem.
It turned out the backend database did not have the PrimaryKey set for the table, and there was a weird corrupted record with a null in the field that should have been the Primary Key, and garbage in the other fields. I set the Primary Key, deleted the garbage records and problem went away.
I was getting an error 2046 at the lines
Code:
With Me[INDENT] If Not NewRecord Then
DoCmd.RunCommand acCmdSaveRecord
DoCmd.RunCommand acCmdRecordsGoToNew
End If
[/INDENT]End With
It turned out the backend database did not have the PrimaryKey set for the table, and there was a weird corrupted record with a null in the field that should have been the Primary Key, and garbage in the other fields. I set the Primary Key, deleted the garbage records and problem went away.