Loading textbox value when a checkbox is clicked

Hi Mr. B,
so the table has the ckeckboxes, and my sub form basically has all those fields including the checkbox. So if the checkbox is clicked its acutally ckicked in the table...does that make sense? and the textbox is on the main form where it calculates the sum using the dsum function... but again i need a way to save the changes on the table so that the main form is requeried at that point..

maybe this is not the right way to go and i need to go back to the original idea...
 
Hi Mr. B,
thank you for helping me... i am attaching the sample DB of what i have done so far.. maybe this will help you in understanding what the issue is?

in the end i want to store the hrs in the Main table (TblMain and FrmMain), but in order to do so i need to first figure out what the hours (as the user can pick and choose) and so thats why i created the TblImp, FrmTblImpsubform, FrmScopeImp...

any help you can provide would be great. or the right direction as to what i should do... please use simple terms as i am new at this and may have this whole thing wrong... the design may not be good?? and i need to start all over??? please help. thanks! Summer
 

Attachments

I think I have been confused as to where things were located.

If your checkbox is on your sub form and the calculation is be done in the main form then try this in that after update event of each check box that affects the calculations:

Code:
if me.dirty then
    'save the changes
     me.dirty = false
end if
Forms!frmScopeImp.Refresh
 
Last edited:
Please check my previous post as I have now had a chance to look at the database file you attached and I have modified the code that I sent in my previous post.

I have also attached a modified the file and attached it here.
 

Attachments

thanks Mr. B! this is working fine but i want to understand the code... what does Me.Dirty?
 
and how do i know store the calculated value in my main table? is there a way to take the value in the FrmScopeImp and store it in the TblMain as text meaning it cant change there? In TblMain, each ID can have different hrs..
 
... what does Me.Dirty?
Me.dirty is just a way to check to see if any data have been changed on the form. If no data has changed the "Dirty" property of the form will be false. When any change has been made to the data in any control on the form, the "Dirty" property of the form will be true. Setting the dirty property of the form to true in code just saves or commits the modification to the table. Data changed in a form is not immediately committed to the table. Exiting the record or specifically saving the changes does commit the changes to the table. So the code simple says if the Dirty property is true set it to false, saving the record.

how do i know store the calculated value in my main table? is there a way to take the value in the FrmScopeImp and store it in the TblMain as text meaning it cant change there?

It is not considered to be appropriate to store calculated valued in tables. The correct method is that if a value can be calculated, then it should be calculated each time it is needed. Calculating the values each time prevents calculated values form becoming invalid because that were not recalculated when other data has changed.

If you have a situation where the data used to make the calculation will absolutely will never change, the it might be alright in your case to save the calculated values.

To answer your question, yes, it is possible to save the calculations to a table. You would again need to use VBA code to read the calculated values and write them to the table.

First, determine if you really want to store these calculated values and then we can go from there.
 
Thank you Mr. B. Ok you're right i dont think thats what i want. If you look at my main form, the user has the ability to add records on there, so with each record the Hrs can change as well. So for example on my db i have 2 records on the main form, first is the ID "DEF" second is "ABC". What I am strugging with now is, how do i give access to the user so that they can go on the "FrmScopeImp" form and calculate what they want and its different for both and is stored differently on the main table as the main form is bound to the main table? So meaning "DEF" can have DBD checked off and the hrs for phases would be "34, 60, 56, 16" but for ID "ABC" both DBD and DBC are checked off and it has now "55, 80, 94, 22". Thanks again for all your help on this one! Summer
 
Ok, I first assume you are using Access 2010.

If my understanding is correct of what you are wanting to do, I would suggest that when you have everything working as needed, there are some things you will need to do.

First, you will need to split you database. Do a Goggle on Splitting and Access database and you should find plenty of info about this and how it works. If you have specific questions about it you can post back, but if multiple people are going to be using your database, it must be split to work efficiently and correctly without having to deal with file corruption.

Next, if your users do not have Access 2010 installed on their computer, you will need to have each user download the free RunTime version of Access 2010. You will need to make sure that you have provided access to any menu commands or any and all other actions needed by the user and that you are not relying on any of the built-in features of Access 2010 because when using the runtime version, most of the built-in functionality of Access is not available.

Once the users have the runtime version, you can provide them with either the accdb version or create an accde (locked down) version of the database that is linked to the data. With this type of installation in place, each user will have their own copy of the front-end database linked to the back-end file.
 

Users who are viewing this thread

Back
Top Bottom