I do not want to use an Autonum data type for my Project_ID field, but I would like to keep them incremented by 1.
I think the best way to do this is to examine the LAST record's Project_ID, store it, add '1' to it, then move to a NEW record and use that new value in the File_Num field.
CODE
'ensure that the data loads - seemed to be an issue so we will force it
'Me.Refresh
'declare variable to store LastNumber from Project_ID
Dim LastNum As Integer
'declare and populate stdocname to satisfy DoCmd
stDocName = "frm_NewProject"
'move to last record
DoCmd.GoToRecord acDataForm, stDocName, acLast
'load variable with value from File_Num
LastNum = Me.File_Num.Value
'increment LastNum
LastNum = LastNum + 1
'go to New record
DoCmd.GoToRecord acDataForm, stDocName, acNewRec
'populate File_id with new value
Me.File_Num.Value = LastNum
The current result is an Access error message "The expression you entered has a field, control, or property name that Access can't find". When I debug it takes me to the line "LastNum = Me.File_Num.Value" and LastNum has a value of 0, but Me.file_num.value has a value of 2633 (the correct value for the 'last' record).
MSKB has nothing helpful.
Any suggestions???
Thanks!