Hello:
When I write new record I have the following code:
[code=vb]
Private Sub Form_BeforeUpda te(Cancel As Integer)
Me!RowIsActive = False
'When a user is creating a new record the following code inserts the MonthID, YearID and
'The LocationsID. It does a Dlookup for the Locations ID when the control cboLocation is
'blank.
'Make sure required fields are filled out first
Dim frm As Form
Set frm = Forms!Forecast
If IsNull(frm![Policy_Type]) Or IsNull(frm![Insured_Name]) _
Or IsNull(frm![ProductIDFK]) Or IsNull(frm![Binding_Percent age]) Then
If IsNull(frm![Policy_Type]) Then MsgBox "Please select a Policy Type from" & _
" the list, thank you", 32, "Select a Policy Type"
If IsNull(frm![Insured_Name]) Then MsgBox "Please indicate who the Insured" & _
" is, thank you", 32, "Select an Insured"
If IsNull(frm![ProductIDFK]) Then MsgBox "Please choose a LOB from the" & _
" list, thank you", 32, "Select an LOB"
If IsNull(frm![Binding_Percent age]) Then MsgBox "Please choose a Binding Percentage from" & _
" the list, thank you", 32, "Select a Binding Percentage"
Cancel = True
Else: Cancel = False
End If
'If all req fields are populated then proceed to write the record to the forecast table.
If Me.NewRecord Then
'etc........
[/code]
My problem is when [ProductIDFK] is blank the record still writes. That is to say I never get a warning up front like I do for [Policy_Type], [Insured_Name] or [Binding_Percent age]
I have looked at the name of the control on the form via its properties and it is called [ProductIDFK]. What could it be??
Any help would be great....
Keith.
When I write new record I have the following code:
[code=vb]
Private Sub Form_BeforeUpda te(Cancel As Integer)
Me!RowIsActive = False
'When a user is creating a new record the following code inserts the MonthID, YearID and
'The LocationsID. It does a Dlookup for the Locations ID when the control cboLocation is
'blank.
'Make sure required fields are filled out first
Dim frm As Form
Set frm = Forms!Forecast
If IsNull(frm![Policy_Type]) Or IsNull(frm![Insured_Name]) _
Or IsNull(frm![ProductIDFK]) Or IsNull(frm![Binding_Percent age]) Then
If IsNull(frm![Policy_Type]) Then MsgBox "Please select a Policy Type from" & _
" the list, thank you", 32, "Select a Policy Type"
If IsNull(frm![Insured_Name]) Then MsgBox "Please indicate who the Insured" & _
" is, thank you", 32, "Select an Insured"
If IsNull(frm![ProductIDFK]) Then MsgBox "Please choose a LOB from the" & _
" list, thank you", 32, "Select an LOB"
If IsNull(frm![Binding_Percent age]) Then MsgBox "Please choose a Binding Percentage from" & _
" the list, thank you", 32, "Select a Binding Percentage"
Cancel = True
Else: Cancel = False
End If
'If all req fields are populated then proceed to write the record to the forecast table.
If Me.NewRecord Then
'etc........
[/code]
My problem is when [ProductIDFK] is blank the record still writes. That is to say I never get a warning up front like I do for [Policy_Type], [Insured_Name] or [Binding_Percent age]
I have looked at the name of the control on the form via its properties and it is called [ProductIDFK]. What could it be??
Any help would be great....
Keith.
Comment