473,467 Members | 1,565 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

sum() function problem help plz...

16 New Member
Expand|Select|Wrap|Line Numbers
  1.  
  2. why this sum function won't work ? 
  3. eg Sum(personal)
  4. lblPersonal.Caption it wont retrieve the sum value of personal
  5.  
  6. Dim cn6 As New ADODB.Connection
  7. Dim strCNString4 As String
  8. Dim rs6 As New ADODB.Recordset
  9. Dim intFound6 As Double
  10.  
  11. strCNString6 = "Data Source=" & App.Path & "\PayrollBakeryDB.mdb"
  12. cn6.Provider = "Microsoft Jet 4.0 OLE DB Provider"
  13. cn6.ConnectionString = strCNString6
  14.  
  15. cn6.Open
  16.  
  17.     With rs6
  18.         '.Open "SELECT Sum(personal), Sum(sick), Sum(vacation), Sum(maternity), emp_id, from_date, to_date FROM leavela WHERE Month(from_date)=" & intMonth & " and Year(from_date)=" & intYear & " and Month(to_date)=" & intMonth & " and Year(to_date)=" & intYear & " GROUP BY emp_id, from_date, to_date ", cn6, adOpenDynamic, adLockOptimistic
  19.  
  20.          Do Until .EOF
  21.  
  22.              If !emp_id = txtEmp_ID.Text Then
  23.                    lblPersonal.Caption = rs6.Fields(0) 'here
  24.                    lblSick.Caption = rs6.Fields(1) 'here
  25.                    Vacation.Caption = rs6.Fields(2) 'here
  26.                    lblMaternity.Caption = rs6.Fields(3) 'here
  27.  
  28.                     intFound6 = 1
  29.              End If
  30.  
  31.             .MoveNext
  32.           Loop
  33.  
  34.           'If intFound6 = 0 Then
  35.                    'MsgBox "Employee ID not found !", vbExclamation, "Error"
  36.           'End If
  37.  
  38.      End With
  39.  
  40.  
  41.  
  42.  
May 26 '07 #1
1 1094
Killer42
8,435 Recognized Expert Expert
Can you give us more of an idea as to what the problem is, than "won't work"?
May 27 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

52
by: Paddy | last post by:
I was browsing the Voidspace blog item on "Flattening Lists", and followed up on the use of sum to do the flattening. A solution was: I would not have thought of using sum in this way. When...
3
by: adnanahmed714 | last post by:
i am trying SQL Sum() function in vb to get sum of one database column but not getting result. select Sum(columnname) from emp. help me i want sum value to display in textbox. also i...
2
n8kindt
by: n8kindt | last post by:
i don't know what to do about this one. there are some very strange things going on. i have a continuous form with a bound textbox and a bound toggle button. the textbox is named "Payment" and the...
54
by: bearophileHUGS | last post by:
Empty Python lists don't know the type of the items it will contain, so this sounds strange: 0 Because that may be an empty sequence of someobject: 0 In a statically typed language in...
6
by: azegurb | last post by:
Hello, I have one question again i created one table again and in this table i added some another options for ex at the previous table there were only one problem sum of the dynamically added...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
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,...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.