|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Forms - Using checkboxes to gather data from datafields in tables
HI all,
Im having problems with the creation of my ms access database which is a school project for me. I have created some forms with buttons and checkboxs. What i want to do is that every buttons and checkbox is linked to data which is stored in different tables in the same database. The user will go through a few forms and on each form there a couple buttons and checkbox and the user will click on the ones which is appropiate for his/her situation. So every time i click on a button or a checkbox i want it to gather the datafields in the tables which i defined before. On the last form there is a button(generate) which is supposed to put all the datafields gathered by clicking on the buttons and checkboxes in the previous forums into one last report where all the datafield from the tables are vissible and also the value of the fields. I tryed to realize this but im still not able to. Can someone please help me with this problem. thnx in advance and hopefully there is someone who is willing to help me. Mike |
|
#2
|
|||
|
|||
|
First, if these are all check boxes and buttons, you really don't need the last button to populate the fields on the table. It can be done in each checkboxes or buttons OnClick event.
For example, in Design view on the form, right click on a checkbox, under the Events tab, go to OnClick, then click the 3 dots, and select Code builder. By default you should get: Private Sub NameOfCheckBox_Click End Sub In between the lines type something like: If Me![NameOfCheckbox] = True Then Me![NameOfTable.NameOfField] = Now() Else Me![NameOfTable.NameOfField] = Null End If The Now() of course just puts the date in the field on the table, for example to notate the date that that step in the work was completed. But you could replace that with = "Hello" if you wanted it to write that into the table. Or it could be a field in the form: Me![NameOfTable.NameOfField] = Me![NameOfForm.NameOfField] Or it could increment a value Me![NameOfFormorTable.NameOfField].Value = Me![NameOfFormorTable.NameOfField].Value + 1 There is an endless world of possibilities......just put what you want after the Then in the If statement, and make sure you have something in the Else. Hope that gets you going on the right track! |
|
#3
|
|||
|
|||
|
Quote:
thnx for the reaction im trying to make this work now. But im kinda confused, if i use this code you described and i want to copy fields from one table into another table every time i check a checkbox how can i manage that. The fields should be summed in the same table. But thnx for so far anyway ![]() |
|
#4
|
|||
|
|||
|
Just make the True value commands:
[tablename].[fieldname] = [othertablename].[otherfieldname] For the fields where you want the sum, just make the default value: [tablename].[fieldname] + [tablename].[fieldname] See if that helps. |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Forms - Using checkboxes to gather data from datafields in tables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|