Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 24th, 2004, 08:40 AM
Registered User
Join Date: May 2004
Location: abu dhabi, , United Arab Emirates.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default between dates

how to use a mixed criteria in an unbound form.
i have employees table, including employee no, att_date,payment.
in form named (hats) i would like to calculate the salary in (emloyees) table, if the employee no = forms!hats!employee_no and att_date between forms!hats!date1 and forms!hats!date2


  #2 (permalink)  
Old May 30th, 2004, 05:20 PM
Authorized User
Join Date: Oct 2003
Location: Toronto, Ontario, Canada.
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Capitala,
not sure if I understand entirely your objective, but maybe these options may lead you closer.
In the ControlSource property of an unbound textbox, you can use DSUM, which gives a total of all records, in a particular field, in accord with the criteria.
=DSUM("fieldname","tablename","tablename.EmployeeN o = 13 And tablename.att_date Between #12/31/03#And#12/31/04#")
you can use this in VBA also, if you need to stipulate certain more criteria, or use a math equation etc...

Without knowing further, how you are going about the calculation, I'm not sure what else to suggest. eg once you've restricted the employee# and the date worked, do you now multiply wage by hours, is the salary automatically entered provided the employee worked that duration?
you could even open a recordset, specify the criteria, make your calculations & update a particular field accordingly.
Please elaborate, if need be.
Hope this helps, good luck!

Similar Threads
Thread Thread Starter Forum Replies Last Post
dates again dhoward VB.NET 2002/2003 Basics 12 August 22nd, 2007 09:48 AM
dates DARSIN General .NET 4 January 14th, 2005 09:09 AM
dates in iis pab006 Classic ASP Basics 2 August 19th, 2004 01:08 AM
Dates treadmill SQL Language 3 July 3rd, 2003 02:32 PM
Dates oathamm Servlets 1 June 27th, 2003 05:43 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.