radhika1990
New member
- Local time
- Today, 11:16
- Joined
- Jul 24, 2009
- Messages
- 4
I have a Form CenterStock on which I have an unbound textbox "Text6". I need to change its control source based on the value of the field Supply (which is bound to the field Supply)
The Code for the control source (With Nz(DSum...)) worked when I had two separate textboxes (by putting it in directly in th control source property in design view mode of the 2 boxes), but its not working when I put this in my form's OnCurrent event.
Private Sub Form_Current()
If Me!Supply.Value = 1 Then
Text6.ControlSource = Nz(DSum("[QtySupplied]", "CenterIndentSupplyQuantity2", "[SupplyID]= Forms!CenterStock!SupplyID"), 0)
ElseIf Me!SupplyID.Value = 2 Then
Text6.ControlSource = Nz(DSum("[Quantity]", "ChangesInCenterStockMore", "[Supply]= Forms!CenterStock!SupplyID"), 0)
End If
End Sub
Please help me with this, or provide an alternate way to do this.
Any help will be appreciated. Thanks in advance,
Radhika
The Code for the control source (With Nz(DSum...)) worked when I had two separate textboxes (by putting it in directly in th control source property in design view mode of the 2 boxes), but its not working when I put this in my form's OnCurrent event.
Private Sub Form_Current()
If Me!Supply.Value = 1 Then
Text6.ControlSource = Nz(DSum("[QtySupplied]", "CenterIndentSupplyQuantity2", "[SupplyID]= Forms!CenterStock!SupplyID"), 0)
ElseIf Me!SupplyID.Value = 2 Then
Text6.ControlSource = Nz(DSum("[Quantity]", "ChangesInCenterStockMore", "[Supply]= Forms!CenterStock!SupplyID"), 0)
End If
End Sub
Please help me with this, or provide an alternate way to do this.
Any help will be appreciated. Thanks in advance,
Radhika