Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 19th, 2009, 09:11 AM
mike123 mike123 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Posts: 4 mike123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 m 54 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old November 23rd, 2009, 07:41 PM
kvar kvar is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 28 kvar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 51 m 17 sec
Reputation Power: 0
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!

Reply With Quote
  #3  
Old November 24th, 2009, 05:08 AM
mike123 mike123 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Posts: 4 mike123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 m 54 sec
Reputation Power: 0
Smile

Quote:
Originally Posted by kvar
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!


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

Reply With Quote
  #4  
Old November 24th, 2009, 07:21 AM
kvar kvar is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 28 kvar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 51 m 17 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Forms - Using checkboxes to gather data from datafields in tables


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek