Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Main Form control value when subform control value is modified 1

Status
Not open for further replies.

AaronMV

Programmer
Apr 18, 2006
15
US
I need some help. I am working with an order form (frmProcessUnfilledOrders) which has an item detail subform. The subform contains a text control for "backordered quantity". I want to create a test with an IF THEN that if any item on the subform has the backordered control set to a value other than 0, then change the "order status" option group control value on the parent order form to "3".

I have created my IF THEN in the Changed event for the Backordered control. I realize this is probably really bad code, but here it is:

Private Sub txtBackordered_Change()

Dim numBOValue As Integer
Dim numStatus As Integer

numBOValue = txtBackordered.Value

If numBOValue > 0 Then
numStatus = 3
DoCmd.GoToControl (frmProcessUnfilledOrders.frameOrderStatus)
frameOrderStatus.Value = numStatus

End If

End Sub


Thanks for helping a beginner out of a hole!

Aaron
 
Private Sub txtBackordered_AfterUpdate()
On Error Resume Next
If Val(Nz(Me.txtBackordered,0)) > 0 Then
Me.Parent.frameOrderStatus=3
End If
End Sub

That should do. The error handling just prevents the code to stop if you don't have the frameOrderStatus control on the parent.

HTH

[pipe]
Daniel Vlas
Systems Consultant

 
Dan,

Thanks much. Your code was perfect.

Aaron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top