G
Guest
I have cancellation form which have 4 fields to be filled. In the same form i
have added corresponding 4 fields which shows what's their value in invoice
form. (thru dlookup)
Also have added validation that 4 fields in cancellation cant be different
from value in invoice fields (before update event)
Now i wanted to ensure that if Field1 based on invoice is null, then only
field1 based on cancellation should be null, else value is must. Following
are the codes:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim aSector1 As Variant
Dim aSector2 As Variant
Dim aSector3 As Variant
Dim aSector4 As Variant
aSector1 = DLookup("[Ticket Level]![FltTicketSector1]", "Ticket Level",
"[Ticket Level]![SubTransNo]=[Cncl Ticket Level]![SubTransNo]")
aSector2 = DLookup("[Ticket Level]![FltTicketSector2]", "Ticket Level",
"[Ticket Level]![SubTransNo]=[Cncl Ticket Level]![SubTransNo]")
aSector3 = DLookup("[Ticket Level]![FltTicketSector3]", "Ticket Level",
"[Ticket Level]![SubTransNo]=[Cncl Ticket Level]![SubTransNo]")
aSector4 = DLookup("[Ticket Level]![FltTicketSector4]", "Ticket Level",
"[Ticket Level]![SubTransNo]=[Cncl Ticket Level]![SubTransNo]")
If Me!FltCnclTicketSector1 <> Me![Text17] Then
MsgBox " Sector 1 Mismatch", vbOKOnly
Cancel = True
ElseIf Me!FltCnclTicketSector2 <> Me![Text21] Then
MsgBox " Sector 2 Mismatch", vbOKOnly
Cancel = True
ElseIf Me!FltCnclTicketSector3 <> Me![Text23] Then
MsgBox " Sector 3 Mismatch", vbOKOnly
Cancel = True
ElseIf Me!FltCnclTicketSector4 <> Me![Text25] Then
MsgBox " Sector 4 Mismatch", vbOKOnly
Cancel = True
End If
End Sub
How should i ensure that Field1 of cancellation cant be null if there's
value in corresponding Field1 based on invoice value or Field1 of
cancellation can be null when value in corresponding Field1 based on invoice
value is null
Thanks
have added corresponding 4 fields which shows what's their value in invoice
form. (thru dlookup)
Also have added validation that 4 fields in cancellation cant be different
from value in invoice fields (before update event)
Now i wanted to ensure that if Field1 based on invoice is null, then only
field1 based on cancellation should be null, else value is must. Following
are the codes:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim aSector1 As Variant
Dim aSector2 As Variant
Dim aSector3 As Variant
Dim aSector4 As Variant
aSector1 = DLookup("[Ticket Level]![FltTicketSector1]", "Ticket Level",
"[Ticket Level]![SubTransNo]=[Cncl Ticket Level]![SubTransNo]")
aSector2 = DLookup("[Ticket Level]![FltTicketSector2]", "Ticket Level",
"[Ticket Level]![SubTransNo]=[Cncl Ticket Level]![SubTransNo]")
aSector3 = DLookup("[Ticket Level]![FltTicketSector3]", "Ticket Level",
"[Ticket Level]![SubTransNo]=[Cncl Ticket Level]![SubTransNo]")
aSector4 = DLookup("[Ticket Level]![FltTicketSector4]", "Ticket Level",
"[Ticket Level]![SubTransNo]=[Cncl Ticket Level]![SubTransNo]")
If Me!FltCnclTicketSector1 <> Me![Text17] Then
MsgBox " Sector 1 Mismatch", vbOKOnly
Cancel = True
ElseIf Me!FltCnclTicketSector2 <> Me![Text21] Then
MsgBox " Sector 2 Mismatch", vbOKOnly
Cancel = True
ElseIf Me!FltCnclTicketSector3 <> Me![Text23] Then
MsgBox " Sector 3 Mismatch", vbOKOnly
Cancel = True
ElseIf Me!FltCnclTicketSector4 <> Me![Text25] Then
MsgBox " Sector 4 Mismatch", vbOKOnly
Cancel = True
End If
End Sub
How should i ensure that Field1 of cancellation cant be null if there's
value in corresponding Field1 based on invoice value or Field1 of
cancellation can be null when value in corresponding Field1 based on invoice
value is null
Thanks