[dba-VB] transfer of data from sub to main form

Stuart McLachlan stuart at lexacorp.com.pg
Wed Oct 29 23:13:27 CDT 2008


As answered on the AccessD list:

You don't need the Refresh button.  Set the value of TotalCharQty to
"=Sum(CharQty)". That way,  the total will keep itself updated.

If you want to have Observations automatically filled in, but also want to
ability to enter it manually, one way is to fill in the value when you
enter the field, you can then accept the entry or enter something else. To
do this, use an On Enter event procedure like this:

Private Sub Observations_Enter()
If IsNull(Observations) or Observations = "" Then 'only update if it's
empty
 Observations = subfrmCharPA.Form.TotalCharQty
End if
End Sub


On 29 Oct 2008 at 23:53, John Eget wrote:

> Hi
> 
> In an Access database
> 
> On the form named frmPAInput, I click on a command button to open a subform named subfrmCharPA 
> 
> After entering several records that contain values on the subform named subfrmCharPA, I display a total value by depressing a command button labeled Refresh Total.  That enables the values of CharQty that have been entered on the subform to be totalled and displayed in a text box named TotalCharQty on the subform
> 
> I then can manually enter that value on the form frmPAInput, in a field named Observations. 
> 
> Is it possible to have the value be automatically entered from the subform to the main form?  And also if there were no subform entries, would I still be able to enter an observation value manually?
> 
> I have tried the wizard to generate the code but have been unable to get this correct.
> 
> Thanks
> 
> John
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
> 





More information about the dba-VB mailing list