I have a database where each record needs to have an autogenerated number in sequential order depending on the value in the "team" field. I have gotten most of the code worked out except for the part when the database is closed the variables are cleared and the next person who enters a record upon opening starts at number one again. How can I store the ending value after the DB is closed so that the next user who opens the DB gets the correct value? I have included my code thus far any suggestions would be greatly appreciated
Dim pintBenefits As Long
Dim pintClaims As Long
Dim pintCrossFunct As Long
Dim pintMembership As Long
Dim pintProvider As Long
Sub frmRequirements()
If Form_frmRequirements.cmbTeam = "" Then
Call MsgBox("Please enter a team before
proceeding",vbOKOnly, "Required Field!"
Else
If Form_frmRequirements.cmbTeam = "Benefits" Then
Form_frmRequirements.RequireNo = pintBenefits + 1
pintBenefits = Val(Form_frmRequirements.RequireNo)
Else
If Form_frmRequirements.cmbTeam = "Claims" Then
Form_frmRequirements.RequireNo = pintClaims + 1
pintClaims =
Val(Form_frmRequirements.RequireNo)
Else
If Form_frmRequirements.cmbTeam =
"Cross-Functional" Then
Form_frmRequirements.RequireNo =
pintCrossFunct + 1
pintCrossFunct =
Val(Form_frmRequirements.RequireNo)
Else
If Form_frmRequirements.cmbTeam
= "Membership" Then
Form_frmRequirements.RequireNo =
pintMembership + 1
pintMembership =
Val(Form_frmRequirements.RequireNo)
Else
If Form_frmRequirements.cmbTeam
= "Provider" Then
Form_frmRequirements.RequireNo =
pintProvider + 1
pintProvider =
Val(Form_frmRequirements.RequireNo)
End If
End If
End If
End If
End If
End If
End Sub
Thanks
Mike
Dim pintBenefits As Long
Dim pintClaims As Long
Dim pintCrossFunct As Long
Dim pintMembership As Long
Dim pintProvider As Long
Sub frmRequirements()
If Form_frmRequirements.cmbTeam = "" Then
Call MsgBox("Please enter a team before
proceeding",vbOKOnly, "Required Field!"
Else
If Form_frmRequirements.cmbTeam = "Benefits" Then
Form_frmRequirements.RequireNo = pintBenefits + 1
pintBenefits = Val(Form_frmRequirements.RequireNo)
Else
If Form_frmRequirements.cmbTeam = "Claims" Then
Form_frmRequirements.RequireNo = pintClaims + 1
pintClaims =
Val(Form_frmRequirements.RequireNo)
Else
If Form_frmRequirements.cmbTeam =
"Cross-Functional" Then
Form_frmRequirements.RequireNo =
pintCrossFunct + 1
pintCrossFunct =
Val(Form_frmRequirements.RequireNo)
Else
If Form_frmRequirements.cmbTeam
= "Membership" Then
Form_frmRequirements.RequireNo =
pintMembership + 1
pintMembership =
Val(Form_frmRequirements.RequireNo)
Else
If Form_frmRequirements.cmbTeam
= "Provider" Then
Form_frmRequirements.RequireNo =
pintProvider + 1
pintProvider =
Val(Form_frmRequirements.RequireNo)
End If
End If
End If
End If
End If
End If
End Sub
Thanks
Mike