Hello Experts !
I need to know that is there good Add-in /tool that i can create report in excel user defined format by selecting the date from calender in excel and get the desired date data in excel from sqlserver Database?
many thanks
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Reporting in Excel by data source (SQL Server)
This might have something to offer you:
How to import data from Microsoft SQL Server into Microsoft Excel
Respected Zeddy 🙂
Like i have a report template in excel and i want only retrieve the data for the date which i need e.g 1/1/2012. I have a idea to get data from database to excel sheet but i need that by selecting a example 1/1/2012 some thing like calender on excel sheet the data comes only for selecting date from excel.
Thanks
farrukh,
Will you be drawing recordsets from a query that has already been filtered by date or by filtering recordsets from a table? Below are 2 untested code segments that may point you in the right direction. They will need to be modified and expanded on.
HTH,
Maud
Dim connection1 As New ADODB.Connection Dim rcrdset As New ADODB.Recordset ‘—————————– rcrdset.Open “Select * From Query1″, connection1 [COLOR=”#008000”]’CHANGE QUERY1 TO NAME OF QUERY[/COLOR] Worksheets(“ReportTemplate”).Range(“A1”).CopyFromRecordset rcrdset ‘——-OR———- Const Querystr As String = “SELECT * FROM [I][B][COLOR=”#FF0000″]table1[/COLOR][/B][/I] WHERE [I][B][COLOR=”#FF0000″][datefield][/COLOR] [/B][/I]Between #8/1/2013# And #8/8/2013#;” rcrdset.Open Querystr, connection1
Zeddy/Maudibe,
The sample sheet having a module name “CALL_DB_DATA” which contains on code name Tester. Is it possible that the below code area i mean the date selection area will call from excel button then the pop up menu comes for both ranges like calendar selection of different ranges availablity?
subArray(3) = CDate(“4/7/2012”)
subrAray(4) = “TO_DATETIME”
subArray(5) = CDate(“11/11/2012”)
Thanks
Hi Farruk
I have attached my version of your submitted file.
I have added some named cell ranges for the [startDate] and [endDate]
These cell values can be easily read with vba.
I have assigned macros to the blue [Start Date] and [End Date] buttons.
This will display a month calendar, to allow a date to be clicked.
I have assumed that start and end dates cannot be in the future, so this is automatically disallowed via the vba code.
If you select a start date that is later than the current end date, then the end date will be automatically set to the same start date.
If you select an end date that is earlier than the current start date, then the start date will be automatically set to the same end date.
You can use the clicker buttons to adjust the start and end dates as well.
NOTE: same rules apply: you can’t have a start date which is later than the end date, and you can’t have an end date which comes before the existing start date.
I’m sure you could make use of these.
zeddy
Respected Zeddy,
Thanks i check that the dates which is provided from excel sheet shown in the zEndDate = [endDate] but i got the attached error?
Hi Farrukh
Many thanks for letting me know it worked OK.
In my previous attached files, I updated your custom Function ExcelVersion(), in your module named Compatibility
This Function has now been updated to include Excel2010 and the new Excell2013.
If you were using either of these Excel versions, your Function would have said “Too Old!“, which, of course, they are not.
This has been fixed with my update.
zeddy
Respected Zeddy,
I have upgraded MS Office 2007 to MS Office 2010. In Office 2007 the code work for me but in Office 2010 the Form does not load and it says attached error.
34976-Screenshot134977-Screenshot2
Your help always make people life easy…
Hi Farrukh
The Calendar Control (called MSCAL.OCX) was last shipped with Office 2007.
(It is usually included with Access, so would be part of Office Professional, which includes Access)
It is not included in later versions of Office.
In Office 2010 they have replaced this date picker with an updated version in the
Active-X library, called MSCOMCT2.OCX. This is for 32-bit Office (NOT Office-64-bit).
The MonthView calendar object is part of MSCOMCT2.OCX
On my laptop, this file MSCOMCT2.OCX is located in two folders:
C:WindowsSystem32mscomct2.ocx
C:WindowsSysWOW64mscomct2.ocx
(Both files mscomct2.ocx are the same file, size 659,264 bytes, file dated 24/03/2009)
Check whether you have this file on your computer.
If not, it is freely available for download here:
You can download Microsoft Windows Common Controls-2 6.0 from the following Microsoft Web site:
http://activex.microsoft.com/controls/vb6/MSCOMCT2.CAB
zeddy
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.