Perhaps I am going about this the wrong way.
I have a form that has 2 subforms, each subform has an options box. When an option is selected in either of the subforms a query reruns and returns a value (being the sum of all items selected) in a list box in the main form. 1 list box for each subform is on the main form.
Next is where the problem comes in. I then have an exit button on the main form, when this is clicked I need to validate that the 2 listboxes equal each other.
I have done this by using a query to against the 2 queries behind the two list boxes. Then adding another list box to return this value. I am then trying to validate if this value <>0.
E.g. List1 = Sum (amt of total selected records from subform1)
list2 = Sum (amt of total selected records from subform2)
list3 (validation)= Sum (amt of total selected records from subform1)- Sum (amt of total selected records from subform2)
I am usig the following code but I get that same result regardless of what the value in List3 is:
Private Sub closemanualrec_Click()
On Error GoTo closemanualrec_Click_Err
If (Me![List3] <> 0) Or IsNull(Me![List3]) Then
Beep
MsgBox "test", vbOKOnly, "test1"
End
' Exit Sub
End If
closemanualrec_Click_Exit:
Exit Sub
closemanualrec_Click_Err:
MsgBox Error$
Resume closemanualrec_Click_Exit
End Sub
I can actually see the reult in List3 and with the above code I get the message being returned regardless of the amount being displayed in List3.
Please help!
I have a form that has 2 subforms, each subform has an options box. When an option is selected in either of the subforms a query reruns and returns a value (being the sum of all items selected) in a list box in the main form. 1 list box for each subform is on the main form.
Next is where the problem comes in. I then have an exit button on the main form, when this is clicked I need to validate that the 2 listboxes equal each other.
I have done this by using a query to against the 2 queries behind the two list boxes. Then adding another list box to return this value. I am then trying to validate if this value <>0.
E.g. List1 = Sum (amt of total selected records from subform1)
list2 = Sum (amt of total selected records from subform2)
list3 (validation)= Sum (amt of total selected records from subform1)- Sum (amt of total selected records from subform2)
I am usig the following code but I get that same result regardless of what the value in List3 is:
Private Sub closemanualrec_Click()
On Error GoTo closemanualrec_Click_Err
If (Me![List3] <> 0) Or IsNull(Me![List3]) Then
Beep
MsgBox "test", vbOKOnly, "test1"
End
' Exit Sub
End If
closemanualrec_Click_Exit:
Exit Sub
closemanualrec_Click_Err:
MsgBox Error$
Resume closemanualrec_Click_Exit
End Sub
I can actually see the reult in List3 and with the above code I get the message being returned regardless of the amount being displayed in List3.
Please help!