I know exactly what you want to do. The issue is, where are you getting the elements?
I see that of "IND/25/07", 25 and 07 probably come from the current date. Where does the IND come from? Without knowing that, here is some code:
On the Before Insert event of the form:
(Assuming field [IND] and field [BillNumber])
(Assuming field [BillNumber] is locked and disabled)
Dim sBillNo As String
Dim sIND As String
If IsNull(Me.IND) Or Me.IND = "" Then
MsgBox "Please enter that field value."
Exit Sub
Else
sIND = Me.IND
End If
sBillNo = sIND & "/" & DatePart("d", Date) & "/" & DatePart("m", Date)
If IsNull(Me.BillNumber) Or Me.BillNumber = "" Then
Me.BillNumber = sBillNo
Else
MsgBox "There is already a Bill Number for this record."
End If
This will automatically create the Bill Number. However, there may be some issues with when the user sees it.
Did that help any? Do a search of Microsoft for "regular expressions".
mmcdonal
|