I have a form having many fields. one field is bill_no and another is BillID.
Bill no is same for some records but BillID is a sequential number which is unique for every record. What I need is that when bill_no change the BillId set to zero and start again from 1. For Example
- Bill No Bill Date Bill ID Emp No Amount
ba/02/01 ...... 1 23445 45
ba/02/01 ...... 2 23568 50
ba/02/01 ...... 3 25896 60
ba/02/01 . ..... 4 25635 105
......
ba/02/01 ...... 1 56324 52
for this Iused following on before update event of bill_no as
Code:
Private Sub bill_no_BeforeUpdate(Cancel As Integer)
Dim ID As Integer
ID = 1
If IsNull(Me![bill_no]) Then
MsgBox "Field can't be empty"
Me.[bill_no].SetFocus
Cancel = True
End If
End Sub
and after update event of another field as
Code:
Private Sub com_ref_AfterUpdate()
Me.SlipID.Value = Me.SlipID.Value + 1
Me.SlipID.DefaultValue = Me.SlipID.Value
End Sub
Its working fine but as the bill no change the value of SlipID doesn't change . I want to initialize it from 1 again.
Wasim