473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to create montly report in excel using sql database in visual basic

1
my sql datbase base in this format--
id of employee,, name of employee,, daily date,, and status= absent or present or weekly off(wo)

---------------------------------------------------------
id employee_name date status
1 puja 12/09/2010 A
1 puja 13/09/2010 A
1 puja 14/09/2010 wo
1 puja 15/09/2010 P
2 poonam 12/09/2010 P
2 poonam 13/09/2010 P
2 poonam 14/09/2010 wo
2 poonam 15/09/2010 A
and so on
--------------------------------------------------------


and in vb form two dtpicker to select date in between i want to check report


now i want to creat excel file in this format
suppose i select data 12/09/2010 to `14/09/2010 now wnt too see all records in between this date
in this format
--------------------------------------------------------
id employee_name 12/09 13/09 14/09
1 puja A A wo
2 poonam P P wo
-------------------------------------------------------




plz help
Sep 17 '10 #1
1 2080
Mariostg
332 100+
That would be a start:
Expand|Select|Wrap|Line Numbers
  1. Function serialize()
  2.     Dim rs As New ADODB.Recordset
  3.     Dim cn As New ADODB.Connection
  4.     Dim sql As String
  5.     Dim aNames As Variant
  6.     Dim thisName As Variant
  7.     Set cn = CurrentProject.Connection
  8.     sql = "SELECT DISTINCT lastName from myTable"
  9.     rs.Open sql, cn
  10.     aNames = rs.GetRows
  11.     rs.Close
  12.     For Each thisName In aNames
  13.         sql = "SELECT status from MyTable" & _
  14.         " WHERE date>= #2010-04-20# AND date<= #2010-04-28#" & _
  15.         " AND lastname='" & thisName & "'"
  16.         rs.Open sql, cn
  17.         s = Replace(rs.GetString, Chr(13), " ")
  18.         Debug.Print thisName & " " & s
  19.     Next thisName
  20.     rs.Close
  21.     Set cn = Nothing
  22.     Set rs = Nothing
  23. End Function
  24.  
Sep 17 '10 #2

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

Similar topics

0
by: Jerry OBrien | last post by:
Can anyone tell me what to import to set up a visual basic .net application to create an Excel spreadsheet and place data into it from a program. I don't know what to Import or what to reference to...
2
by: carlos | last post by:
How can we read / write numbers in a excel data sheet.
1
by: Davy | last post by:
Hi Can somebody help me to print a specific worksheet of an Excel file thru Visual Basic Thank Davy
4
by: bilalbajwa2336 | last post by:
I want to make a program in visual basic. When i put my salary data in VB (like: Time In , Time Out, DAte, DAy) VB automatically (in the back ground) input this data in the Excel and Show out puts of...
0
by: giustav | last post by:
Hello everybody! I find a sourch code about print and preview of Access' Report in Visual Basic 6. Can you help me? Thanks so much, Giuseppe
0
by: Speilman_54 | last post by:
Hi, I'm converting an excel Macro into visual basic 2005 express, as I don't have a copy of VB 6 and trying to make and executable from it, I know this version doesn't have the save file as .exe,...
3
by: HelloWorldHelloWorldHello | last post by:
How to send email to another person with using Microsoft Visual Basic 6.0.?
0
by: okalpana | last post by:
Hi friends, trying to do a application program.. what is the code to open a existing word document or excel file in Visual Basic 5 with a command button. i.e Clicking th button should open a...
1
by: Serenityquinn15 | last post by:
Hi! I'm a newbe in Crystal Report, and it is my first time to use it in my Visual Basic.. I just wonder how I can Install Crystal Report 8.5 for use in Visual Basic 6.0 also connect it to...
7
by: Ramya28 | last post by:
Hi... I need to read and write to an excel sheet with watermark in it by using java.. i can perform the rest of operations i need to on the excel except for watermark image in the output excel.. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
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...

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.