A
Alvin
I have the following code in the On Open Event of a Report. I am new to VB
Code but am learning. I can get one condition to work when I use it Like this.
----------- It Works Like This---------------
Private Sub Report_Open(Cancel As Integer)
If IsNull(Forms!Breeders![Breeders subform].Form!MatingOrderID) Then
MsgBox "You Have Chosen a Mating Order That Has No Value. " &
Chr(13) & Chr(10) & Chr(10) & "You Must Select A Female to Breed With ( " &
[Form_Breeders]![Name] & " ) before you can View This Report! ",
vbInformation, "Breed Manager"
Cancel = -1
Else
End If
End Sub
---------------------------------------------------------------------------------------
but I don't know how to add the second or third. Here are the conditions
and actual names I want to use something Like the following where I can Make
sure needed field have been entered before viewing the Report.
----------------This way I can't get it to work---------------------Private Sub Report_Open(Cancel As Integer)
If IsNull(Forms!Breeders![Breeders subform].Form!MatingOrderID) Then
MsgBox "You Have Chosen a Mating Order That Has No Value. " &
Chr(13) & Chr(10) & Chr(10) & "You Must Select A Female to Breed With ( " &
[Form_Breeders]![Name] & " ) before you can View This Report! ",
vbInformation, "Breed Manager"
Cancel = -1
Else
If IsNull(Forms!Breeders![Breeders subform].Form![BreadFemale]) Then
MsgBox "You Must Choose A Female To Be Bred! " & Chr(13) &
Chr(10) & Chr(10) & "You Have Chosen ( " & [Breeders
subform].Form![BreadFemale].Column(1) & " ) To Breed With ( " &
[Form_Breeders]![Name] & " ) You Must Now Enter a Breed Date! ",
vbInformation, "Breed Manager"
Cancel = -1
Else
End If
End If
End Sub
Code but am learning. I can get one condition to work when I use it Like this.
----------- It Works Like This---------------
Private Sub Report_Open(Cancel As Integer)
If IsNull(Forms!Breeders![Breeders subform].Form!MatingOrderID) Then
MsgBox "You Have Chosen a Mating Order That Has No Value. " &
Chr(13) & Chr(10) & Chr(10) & "You Must Select A Female to Breed With ( " &
[Form_Breeders]![Name] & " ) before you can View This Report! ",
vbInformation, "Breed Manager"
Cancel = -1
Else
End If
End Sub
---------------------------------------------------------------------------------------
but I don't know how to add the second or third. Here are the conditions
and actual names I want to use something Like the following where I can Make
sure needed field have been entered before viewing the Report.
----------------This way I can't get it to work---------------------Private Sub Report_Open(Cancel As Integer)
If IsNull(Forms!Breeders![Breeders subform].Form!MatingOrderID) Then
MsgBox "You Have Chosen a Mating Order That Has No Value. " &
Chr(13) & Chr(10) & Chr(10) & "You Must Select A Female to Breed With ( " &
[Form_Breeders]![Name] & " ) before you can View This Report! ",
vbInformation, "Breed Manager"
Cancel = -1
Else
If IsNull(Forms!Breeders![Breeders subform].Form![BreadFemale]) Then
MsgBox "You Must Choose A Female To Be Bred! " & Chr(13) &
Chr(10) & Chr(10) & "You Have Chosen ( " & [Breeders
subform].Form![BreadFemale].Column(1) & " ) To Breed With ( " &
[Form_Breeders]![Name] & " ) You Must Now Enter a Breed Date! ",
vbInformation, "Breed Manager"
Cancel = -1
Else
End If
End If
End Sub