Validation Rule (1 Viewer)

geoffishere

Registered User.
Local time
Yesterday, 18:09
Joined
Mar 14, 2010
Messages
17
I have a form with a subform. On the main form i have a list box which sums a column in the subform through a query.

I want to ensure that this field equals another field in the main form but cant get it to work. I know this is because of the query which is calculating the sum but i dont know how i can get around this.

Thanks in advance
 

vbaInet

AWF VIP
Local time
Today, 02:09
Joined
Jan 22, 2010
Messages
26,374
If you're talking about making one control's value having the same value as another control's value or field value then you use the Control Source property.

Use the Expression Builder in that property by clicking the elipsis "..." button and locate the other control or field.
 

geoffishere

Registered User.
Local time
Yesterday, 18:09
Joined
Mar 14, 2010
Messages
17
No I dont think thats what i am after,

I have a field in the main form which is calculated from data in the main form and a list box in the main form which sums a column in the sub form through a query.

I dont want the user to be able to close the form unless these two values are the same.

The problem seems to be getting a value from the list box field,

Any ideas

Many Thanks
 

vbaInet

AWF VIP
Local time
Today, 02:09
Joined
Jan 22, 2010
Messages
26,374
Sounds very restrictive Geoff :)

Something along these lines:

Code:
If Me.Main_Form_Control <>  Forms(Main_Form).Controls(Subform_Control).Form!ControlName Then
    .... Not safe to close
End If

You would need to create a button for closing your form instead of using the 'X'. So disable the Control Box. There's no Before Close event.
 

Users who are viewing this thread

Top Bottom