getting Data from a SQL statement

A

Alex

Hi

I am a novice with access programming. I have created a form with a subform.
I would like to run a SQL statement through a button that queries the subform
for the sum of a column and return it in a variable that I can use on the
main form. The 2 forms are of course related by a key. I also need the SQL
query to make sure that the key is checked (of course)

thanks for any help. I appreciate it
 
S

Sprinks

Hi, Alex.

In the subform's footer, place a textbox with the ControlSource set to:

=Sum([YourColumn])

You can refer to its value on the main form by:

=Me!YourSubform.Form!YourSummaryControl

Which you can either use in your code, or as the ControlSource of a textbox
on the main form.

Hope that helps.

Sprinks
 
A

Alex

Hey Sprinks

That was embarassing it was so easy. I appreciate your help. Thanks
--
Alex


Sprinks said:
Hi, Alex.

In the subform's footer, place a textbox with the ControlSource set to:

=Sum([YourColumn])

You can refer to its value on the main form by:

=Me!YourSubform.Form!YourSummaryControl

Which you can either use in your code, or as the ControlSource of a textbox
on the main form.

Hope that helps.

Sprinks


Alex said:
Hi

I am a novice with access programming. I have created a form with a subform.
I would like to run a SQL statement through a button that queries the subform
for the sum of a column and return it in a variable that I can use on the
main form. The 2 forms are of course related by a key. I also need the SQL
query to make sure that the key is checked (of course)

thanks for any help. I appreciate it
 
A

Alex

Hi

I knew it was too easy. Sonce we changed the source control it is doing the
right thing on the screen but not saving the data into the original speed
field. Do I have to do this programatically?

thanks
--
Alex


Sprinks said:
Hi, Alex.

In the subform's footer, place a textbox with the ControlSource set to:

=Sum([YourColumn])

You can refer to its value on the main form by:

=Me!YourSubform.Form!YourSummaryControl

Which you can either use in your code, or as the ControlSource of a textbox
on the main form.

Hope that helps.

Sprinks


Alex said:
Hi

I am a novice with access programming. I have created a form with a subform.
I would like to run a SQL statement through a button that queries the subform
for the sum of a column and return it in a variable that I can use on the
main form. The 2 forms are of course related by a key. I also need the SQL
query to make sure that the key is checked (of course)

thanks for any help. I appreciate it
 
Top