Unanswered: Sequential Number Based on Other Field in Table
My table design is as follows:
Product Type (3 digit numeric code i.e. 120)
Sequence Number (4 or 5 digit numeric code, depending on the product)
Description (text string)
I want to have a form with Product Type, Description and Date. When you hit a button on the form, I want the next sequential number to be assigned to this specific product based on the product type that was chosen from a drop down. Then I would like to have the table where this information lies to be populated with the new information created. Is there a way to do this? I have looked through this forum, as well as other places in the internet but have not found an answer.
I should probably also mention that I am using Access 97, which may be why a lot of what I'm finding on the internet is not working when I try to use the code.
How can I do this? I'm a beginner at using VB so if someone could help me I would greatly appreciate it.
Function AddRecord(rstTemp As Recordset, intLoadCenter As Integer,
strDate As String, intSequenceNmbr As Long, _
intProductNumber As Long, strDescription As String)
!ProductNumber = intProductNumber
!LoadCenter = intLoadCenter
!SequenceNmbr = intSequenceNumber
!Date = strDate
!Description = strDescription
The error comes up and highlights the intSequenceNmbr that is used when calling the function AddRecords... any ideas why this is happening?
Like I said before, SequenceNmbr is 4 or 5 digit number depending on the product. I declared it as a long though because this could eventually become 6 or more digits and I want it to work if this happens also.
Can anyone see why I'm getting this error? My data types match, and I made sure to declare each variable on it's own line so I'm not really sure what else could be causing this... Thanks for the help!