hello,
i'm using 'Access database' and VB 6.0. My database is named ' timesheet' and it contains a table named 'tabletimesheet '. The table contain the following fields: 'staffname, stafftype, date, projectname, projectcode and hoursworked' . On my VB 6.0 form, i have got a ' list Box' containing the 'type of staff', for example 'engineer, manager or secretary'. I have got another 'list Box' containing the 'name of projects' . Also i have got 2 textboxes into which the user will enter the 'Start date' and in the other textbox, the user will enter the 'End date'. I have been using ADODC to connect my List Box and Text Boxes to the database through the DataSource and DataField, is it good? The system i'm developing should then find the total number of hours worked from the 'start date' to the 'end date' for the item selected in the 'type of staff' List Box and for the item selected in the 'name of project' List Box. For example, if i choose 'engineer' in the first List Box, i choose 'project aaa' in my second List Box, i enter '4/5/06' as 'Start date' and '10/9/06' as 'End Date', then the 'sum of the hours worked' by the 'engineer' on 'project aaa' from '4/5/06' to '10/9/06' should be calculated and be displayed in a textbox. How do i do that? What are the code to set the connection to access the table in the database and to calculate the sum of the hours worked and to display it in a textbox? Where should i place the codes?
Need your help urgently.
Can you please send to my private mail an 'address' where your reply will be posted.
Thanks
1 7470
hello,
i'm using 'Access database' and VB 6.0. My database is named ' timesheet' and it contains a table named 'tabletimesheet '. The table contain the following fields: 'staffname, stafftype, date, projectname, projectcode and hoursworked' . On my VB 6.0 form, i have got a ' list Box' containing the 'type of staff', for example 'engineer, manager or secretary'. I have got another 'list Box' containing the 'name of projects' . Also i have got 2 textboxes into which the user will enter the 'Start date' and in the other textbox, the user will enter the 'End date'. I have been using ADODC to connect my List Box and Text Boxes to the database through the DataSource and DataField, is it good? The system i'm developing should then find the total number of hours worked from the 'start date' to the 'end date' for the item selected in the 'type of staff' List Box and for the item selected in the 'name of project' List Box. For example, if i choose 'engineer' in the first List Box, i choose 'project aaa' in my second List Box, i enter '4/5/06' as 'Start date' and '10/9/06' as 'End Date', then the 'sum of the hours worked' by the 'engineer' on 'project aaa' from '4/5/06' to '10/9/06' should be calculated and be displayed in a textbox. How do i do that? What are the code to set the connection to access the table in the database and to calculate the sum of the hours worked and to display it in a textbox? Where should i place the codes?
Need your help urgently.
Can you please send to my private mail an 'address' where your reply will be posted.
Thanks
hi deena,
to get the desired result, here is the sample code
command1_click( )
While Not rs.EOF
If rs(1) = lststafftype.Li st(lststafftype .ListIndex) And rs(3) = lstproject.List (lstproject.Lis tIndex) And CDate(rs(2)) >= CDate(txtstartd ate.Text) And CDate(rs(2)) <= CDate(txtendate .Text) Then
hrsworked = hrsworked + rs(5)
End If
rs.MoveNext
Wend
txthrsworked.te xt = hrsworked
hmm.. to connect your database with the front end, there are so many others who have posted the code. check for sashi's too. you will find them.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: sg_s123 |
last post by:
============================================================================
02-Feb-04 03-Feb-04
Staff Staff 0800hr- 1300hr- 1700hr- 1900hr- 0800hr- 1300hr- 1700hr-
1900hr-
Number Name 1200hr 1700hr 1900hr 2200hr 1200hr 1700hr 1900hr
2200hr
============================================================================
4654 Saniff A A A C A A A C
4437 Joey B C B C B C B C
4479 Elmer C C B C C C B C
|
by: cvisal |
last post by:
Hi all
Im working on productivity calculations (Time calculations) and need
some help in coding.
Database Tool:MS-Access 2003.
The general operator punch-in time is 5:30 AM and the punch-out time is
2:00PM. The Break times are
1) 9:30 AM to 9:45 AM
2) 11:00AM to 11:30 AM
3) 12:30PM to 12:45 PM
|
by: paii, Ron |
last post by:
Sorry about that last one.
Does anyone know how to calculate the width a string of text for given Font
name and size?
I want to buildup a block of text strings to display in a unbound control,
that has limited width but multiple lines. Currently I am using the left$()
function to trim the text to a standard number of characters. I want a
function to return the number of characters that will fit in the width of
the control. To keep the...
|
by: Sector 7G |
last post by:
I'm working with a SQL query for a Human Resources database. Its intended purpose is to find all the paycheck records with a check date (prckhist.chkdate ) more recent than eleven days past the employee's last raise (hrpersnl.p_paydate). It then totals the hours the employee worked from those records (prdehist.units), and if the total is within 40 hours of a threshold (hrpersnl.p_jmisc3) then the employee's name and information is returned, and...
|
by: NormAmst |
last post by:
I have a list of CPU processing times and job durations for an entire department at work. There are 3 classifications I am maintaining. CPU time during peak hours , CPU time during non peak hours and total CPU time. I developed an Excel spreadsheet totaling the times and manually format a spreadsheet to present total jobs run and total CPU time for the department. I also developed an Access 2002 db, where I import all the run job...
| |
by: brendanmcdonagh |
last post by:
Hi,
I am designing a project for my friend as I am just a week old baby to vb and want to implement what I've learnt so far.
She wants to be able to put start time, end time and lunch for each day and then calculate amount of hours worked. So far I have designed form and added code to calculate textbox inputs, (which works!).
However, I didn't think of this at beginning. Say I put .30 for lunch, when I get total hours worked the answer...
|
by: iceone |
last post by:
Hi everybody,
I am monitoring a call center and i need to calculate the working hours between the moment the call is answered and the moment the call is closed.
i need to calculate the working hours difference (ie excluding nights, sundays, saturdays, thanksgiving, ecc,)
i consider as working hours from 09;00 am to 19:30 pm (monday-fryday)
(i.e. from fryday 19:00 to monday 09:30 i want the function to accont for one hour)
have u...
|
by: student4lifer |
last post by:
Hello,
I have 2 time fields dynamically generated in format "m/d/y H:m".
Could someone show me a good function to calculate the time interval
difference in minutes? I played with strtotime() but but that only
gave me difference in hours and only if the times were on the same day
(after wrapping with date() function). TIA
|
by: lizBeth |
last post by:
Hi all,
i seem to have gotten stuck on this coursework, i am unsure as to how to implement a method in the main class to calculate the sum of all employees monthly salaries.
Everything else works on the program it does output the employees details and their monthly salaries. I just need to add them up and output a "Total Payroll: xxxxxx.x " in this format. It sounds simple and it probably is simple, i think i can't see the woods for...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |