I keep getting the same true or false result when using if statement with listbox.
I have a form, on the form are 3 listbox controls. 1st 2 return result from a query initiated on subforms. The 3rd is to be used for validation. I run a query over the results of Lstcont1 & Lstcont2 to get the result in Lst Control3.
I then have the following code to validate Lstcont3 and prevent exiting if it equals 0.
Private Sub closemanualrec_Click()
On Error GoTo closemanualrec_Click_Err
If (Lstcont3 <> 0) Then
Beep
MsgBox "test", vbOKOnly, "test1"
End
End If
DoCmd.SetWarnings False
However it seems I get the same answer regardless of the value showing in Lstcont3.
Any ideas on syntax? Or should I be looking at this a different way?
Cheers
I have a form, on the form are 3 listbox controls. 1st 2 return result from a query initiated on subforms. The 3rd is to be used for validation. I run a query over the results of Lstcont1 & Lstcont2 to get the result in Lst Control3.
I then have the following code to validate Lstcont3 and prevent exiting if it equals 0.
Private Sub closemanualrec_Click()
On Error GoTo closemanualrec_Click_Err
If (Lstcont3 <> 0) Then
Beep
MsgBox "test", vbOKOnly, "test1"
End
End If
DoCmd.SetWarnings False
However it seems I get the same answer regardless of the value showing in Lstcont3.
Any ideas on syntax? Or should I be looking at this a different way?
Cheers