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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need clarification on "Control Source" vs. "Name" 1

Status
Not open for further replies.

rcoutts

Technical User
Sep 5, 2001
60
US
I have a text field, Total, that adds up other fields in the same row, e.g.,
Code:
     Mon Tue Wed Thu Fri Sat Sun Total
      10   8   8   6   8   0   0    40
[\code]
Where the properties of Total are set as
[code]
     Name............. Total
     Control Source... =[Mon]+[Tue]+....
[\code]
It works fine, but I also have an Append Query that attempts to upload the field, Total, to an equivalent field in a master table.  The value being uploaded is (0), which is obviously wrong.  If I change the properties of Total to
[code]
Name............. Total
Control Source... Total
[\code]
Then it uploads fine, but I have to total the row by hand.  Can someone clue me in as to what the role of "Name" and "Control Source" is and how I can upload by automatically totaled field correctly?

Thanks!
Rich
 
The Name Property is Just that a name for the control or form etc.... Where as the Control Source is the field in the table of the database that the information is gathered from.

Set your control Source to Total
create a button and on the OnClick_Event of that button
write this code

Total = [mon]+[tue]+[wed] etc....

If you are not familar with VBA this is how you would do it.
Place a button on the form when the wizard come up cancel it.
right click on the button and selet properties. Go to the Event tab and then go to the OnClick event and double click this will show you event procedure in that line.
Click on the button with the 3 dots (...) then add the line of code I supplied. save and exit.
Every time you click the button the total field will add for you and store it in the total. Then when you run your query it will grab the value in that field.

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top