S
Slez via AccessMonster.com
I believe I am missing portions of code in the BeforeUpdate event and am
wondering if someone can help. Here is my scenario:
I have 3 related tables:
tblProject contains the field ProjectID, which is on the one side of a one-to-
many relationship with...
tblBid contains the fields ProjectID & BidNumber, which is on the one side of
a one-to-many relationship with...
tblScopeNotes contains the fields ProjectID, BidNumber, ScopeNoteID &
ScopeNote
I have a subform where users can enter records into the ScopeNote field and
I'd like to have ScopeNoteID automatically number itself. I have done this
with a second level table, but never a third. So for each ProjectID ;
BidNumber combination, ScopeNoteID would = 1, then 2, then 3, and so on...
In the BeforeUpdate event, I currently have the following code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.ScopeNoteID) Then
Me!ScopeNoteID = Nz(DMax("ScopeNoteID", "tblScopeNotes", "BidNumber
=" & BidNumber), 0) + 1
End If
End Sub
This currently yields the first ScopeNoteID record being 4,5,8,etc. instead
of "1". Once a ScopeNoteID is in, it seems to assign the next available
number, it just doen't start correctly with the first entry.
As mentioned, any help is appreciated!
Thanks!
wondering if someone can help. Here is my scenario:
I have 3 related tables:
tblProject contains the field ProjectID, which is on the one side of a one-to-
many relationship with...
tblBid contains the fields ProjectID & BidNumber, which is on the one side of
a one-to-many relationship with...
tblScopeNotes contains the fields ProjectID, BidNumber, ScopeNoteID &
ScopeNote
I have a subform where users can enter records into the ScopeNote field and
I'd like to have ScopeNoteID automatically number itself. I have done this
with a second level table, but never a third. So for each ProjectID ;
BidNumber combination, ScopeNoteID would = 1, then 2, then 3, and so on...
In the BeforeUpdate event, I currently have the following code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.ScopeNoteID) Then
Me!ScopeNoteID = Nz(DMax("ScopeNoteID", "tblScopeNotes", "BidNumber
=" & BidNumber), 0) + 1
End If
End Sub
This currently yields the first ScopeNoteID record being 4,5,8,etc. instead
of "1". Once a ScopeNoteID is in, it seems to assign the next available
number, it just doen't start correctly with the first entry.
As mentioned, any help is appreciated!
Thanks!