Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sequence Number/Auto Number 1

Status
Not open for further replies.

Nene75

Programmer
Feb 27, 2003
138
US
Hi Everyone:

I am building a Resume Database in MS Access 2000. I need to have computer generate the autonumber/Sequence number based on when the Resume was received at the HR as (Year/Month/Sequence = 200401-001). So the number should be generated from ResumeSubmissionDate and 3 digit sequence number. ResumeSubmissionDate field is filled by the HR admin.

Can anyone help how should I do this?

Thanks in advance!
 
I am using the following code but I am getting run-time error 2450 - MS Access can't find the fsubResumeSubRevInfo form refered to in VB ... :

Function resNum()

If IsNull(Forms!fsubResumeSubRevInfo!ResumeSubmissionDate.Value) Then
Forms!fsubResumeSubRevInfo!ResumeNumber.Value = " "
Else
Forms!fsubResumeSubRevInfo!ResumeNumber.Value = _
Format(Forms!fsubResumeSubRevInfo!ResumeSubmissionDate.Value, "mmddyy") & "-" & _
Format(Forms!fsubResumeSubRevInfo!seq.Value, "000")
End If

Please help!
Thanks!
 
Hi!

Only adressing the 2450.

Perhaps some reference issue - by the name, it sounds like you're refering to a subform.

If it's from the main/parent form, then perhaps:

[tt]Me!fsubResumeSubRevInfo.Form!ResumeNumber.Value[/tt]

If it's in a module then perhaps:

[tt]Forms!MainFormName!fsubResumeSubRevInfo.Form!ResumeNumber.Value[/tt]

- another issue to check - the subform reference refers to the name of the subform control, which doesn't have to be the same as the subform name viewed in the database window. Check out the properties for the subform (where the link child / master fields are) and check if you use the same name.

Roy-Vidar
 
Roy-Vidar:

Thanks for the quick reply.

Yes its a subform where the ResumeNumber should be auto generated. I had once changed the subform name that's why it was not finding it. And yes I am using the code in the Module.

Here's the corrected code and it works great:

Function resNum()

If IsNull(Forms!frmApplicantData!fsubResumeSubRevInfo!ResumeSubmissionDate.Value) Then
Forms!frmApplicantData!fsubResumeSubRevInfo!ResumeNumber.Value = " "
Else
Forms!frmApplicantData!fsubResumeSubRevInfo!ResumeNumber.Value = _
Format(Forms!frmApplicantData!fsubResumeSubRevInfo!ResumeSubmissionDate.Value, "yyyymm") & "-" & _
Format(Forms!frmApplicantData!fsubResumeSubRevInfo!ResumeID.Value, "000")
End If

End Function

Thanks for helping me find the errors!
 
Roy-Vidar,

The ResumeNumber generated doesn't get stored/saved into the table. The number is only displayed in the forms. Any idea?

Pleae help!

Thanks in advance!

 
You don't say anything about errormsg, is it just that you haven't bound the control to the corresponding field in the forms recordsource?

Roy-Vidar
 
Roy-Vidar:

Got it! The ControlSource was unbound.
Thanks a lot - !!!! :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top