In a tabluar form I want some code to automatically pupulate the value of the ProjID field when a new record is created. I've written some code to do this by going to the first record, copying the value from ProjID (if not null) and pasting into the ProjID field of the last record.
If I'm already at the first line, everything works as planned. If I'm at any other field, I get runtime 2105 when the "docmd....acFirst" line is encountered. What's going on? How do I fix this? BTW...I'm a VBA newbie so be gentle.
Private Sub Task_AfterUpdate()
Dim RID As Double
DoCmd.GoToRecord , , acFirst
If IsNull([ProjID]) Then
MsgBox ("Sorry fatty, didn't work")
RID = [ProjID]
DoCmd.GoToRecord , , acLast
[ProjID] = RID
This is in Access 2002, but the database was previously converted from 97.