Trying to add a new record in an Access table through a form. I have an add button on it. I would like to automate populating the next sequencial number in a filed. I can't use autonumber since the data was converted and field had data already. I careated this function to get the next number:
Function NewTrackNum()
Dim sfNum As Integer
Dim SqlStr As String
SqlStr = ("SELECT max(SF_Tracking_Num + 1 FROM Tempus_Issues_Log)"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
NewTrackNum = SqlStr
End Function
In the add button click, I have this line to populate the vaule.
Me.SF_Tracking_Num = NewTrackNum()
When I click the add button, I got this error
(The value you entered isn't valid for this field).
Please help, where did I go wrong.
Thanks
Function NewTrackNum()
Dim sfNum As Integer
Dim SqlStr As String
SqlStr = ("SELECT max(SF_Tracking_Num + 1 FROM Tempus_Issues_Log)"
NewTrackNum = SqlStr
End Function
In the add button click, I have this line to populate the vaule.
Me.SF_Tracking_Num = NewTrackNum()
When I click the add button, I got this error
(The value you entered isn't valid for this field).
Please help, where did I go wrong.
Thanks