G
Gordon Foster
Hi,
I have a subform to input serial numbers into. Sometimes we only need 1
serial number per item and sometimes more therefore I have made my code
lookup how many I need for the 'kit number' selected on the main form and if
I reach that limit I navigate the main form to a new record. I do this in
the AfterUpdate event. It works fine if I only need 1 serial number for a
particular kit. Here is a scenario of the problem if I need 2 serial
numbers:
On the subform...
I scan a serial number and the main form does not go to a new record (as it
should, I only have 1 serial number so far)
I scan a serial number and the main form does go to a new record (as it
should, I've reached the 2 serial number limit)
I scan a serial number and the main form does not go to a new record (as it
should)
....but now I can't add another serial number. For some reason in the
datasheet subform when you start typing the first serial number the next
record box does not show up (with the * in the record selector) as it
normally does. The subform loses it's focus after pressing enter and the
focus goes to a control on the main form. The only way I can add the next
serial is to navigate away from the item and come back. At the point that
it screws up it is almost like the AllowAdditions property has been set to
False.
Any help would be appreciated, below is the code for the AfterUpdate event.
Gordon Foster
Private Sub Serial_Numbers_AfterUpdate()
Dim intSerialsAllowed As Integer 'number of serials needed for a
kit number
Dim intSerialsScanned As Integer 'number of serials currently in
recordset
'force the record to be saved so gathered values are up to date
Me.Dirty = False
intSerialsScanned = Me.RecordsetClone.RecordCount
intSerialsAllowed = HowManySerialsNeededFor(Me.Parent!kitnumberid)
'if we have them all then navigate to the next item
If intSerialsScanned = intSerialsAllowed Then
lngKitNumberID = Me.Parent.kitnumberid 'get current product
selected
Me.Parent.Recordset.AddNew 'navigate user to next
item
Me.Parent.kitnumberid = lngKitNumberID 'set the product to same
as before
Me.Parent.Dirty = False 'parent must have a
saved record
End If
End Sub
I have a subform to input serial numbers into. Sometimes we only need 1
serial number per item and sometimes more therefore I have made my code
lookup how many I need for the 'kit number' selected on the main form and if
I reach that limit I navigate the main form to a new record. I do this in
the AfterUpdate event. It works fine if I only need 1 serial number for a
particular kit. Here is a scenario of the problem if I need 2 serial
numbers:
On the subform...
I scan a serial number and the main form does not go to a new record (as it
should, I only have 1 serial number so far)
I scan a serial number and the main form does go to a new record (as it
should, I've reached the 2 serial number limit)
I scan a serial number and the main form does not go to a new record (as it
should)
....but now I can't add another serial number. For some reason in the
datasheet subform when you start typing the first serial number the next
record box does not show up (with the * in the record selector) as it
normally does. The subform loses it's focus after pressing enter and the
focus goes to a control on the main form. The only way I can add the next
serial is to navigate away from the item and come back. At the point that
it screws up it is almost like the AllowAdditions property has been set to
False.
Any help would be appreciated, below is the code for the AfterUpdate event.
Gordon Foster
Private Sub Serial_Numbers_AfterUpdate()
Dim intSerialsAllowed As Integer 'number of serials needed for a
kit number
Dim intSerialsScanned As Integer 'number of serials currently in
recordset
'force the record to be saved so gathered values are up to date
Me.Dirty = False
intSerialsScanned = Me.RecordsetClone.RecordCount
intSerialsAllowed = HowManySerialsNeededFor(Me.Parent!kitnumberid)
'if we have them all then navigate to the next item
If intSerialsScanned = intSerialsAllowed Then
lngKitNumberID = Me.Parent.kitnumberid 'get current product
selected
Me.Parent.Recordset.AddNew 'navigate user to next
item
Me.Parent.kitnumberid = lngKitNumberID 'set the product to same
as before
Me.Parent.Dirty = False 'parent must have a
saved record
End If
End Sub