473,385 Members | 2,269 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,385 software developers and data experts.

How to get days from a Combo Box?

43 32bit
Hi there!
I have a combo box namely "Statement for". In this combo box all months are entered. When I will select any month in Combo box "Working days" automatically generated. I can use If function, but then what about leap year? After 4 years leap year will come and 29 February will be effected in my database. Any suggestion? Thanks in advance.
Attached Images
File Type: jpg untitled.jpg (47.4 KB, 109 views)
Feb 19 '15 #1
1 859
jforbes
1,107 Expert 1GB
Here is a function you can use:
Expand|Select|Wrap|Line Numbers
  1. Public Function getDaysInMonth(ByRef dDate As Date) As Integer
  2.     getDaysInMonth = DateDiff("d", dDate, DateAdd("m", 1, dDate))
  3. End Function
You get results like this:
Expand|Select|Wrap|Line Numbers
  1. ?getDaysInMonth(dateserial(2016, 2,1))
  2.  29 
  3. ?getDaysInMonth(dateserial(2015, 2,1))
  4.  28 
  5. ?getDaysInMonth(dateserial(2015, 2,29))
  6.  31 
Feb 19 '15 #2

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

Similar topics

10
by: Richard | last post by:
I have created a form which sets up a dataview. The form views one record at a time using a currencymanager. This works fine. All my text boxes bind. However I have a combo box which gets its...
4
by: Steve | last post by:
C# I have some combo boxes, full of lookup descriptions. When I retrieve a dataset for my record, the values that need binding to the combos are the actual record IDs that relate to these...
8
by: Jack | last post by:
Hi, I have a asp page where multiple rows for a client is generated using asp. Some of these are combo boxes and some are text and are coming from a recordset. Now, the following is the code to...
0
by: Jeremy Wallace | last post by:
Folks, Here's a write-up I did for our developer wiki. I don't know if the whole rest of the world has already figured out how to do this, but I hadn't ever seen it implemented, and had spent a...
2
by: Eric Layman | last post by:
Hi, I have a radio button and a combo box. Upon changing a value for radio button, the combo box values will be dynamically updated. I have an idea on how to go abt doing it but Im stuck...
1
by: John Kreps | last post by:
I've tried to get combo boxes to work with Access 2007 for days now without success. What I can't get to work is the autocomplete. I've got three simple tables and one form with two controls....
4
by: MOCaseA | last post by:
I am trying to create a series of combo-boxes that filter the viewable records by the values listed. There are several combo-boxes per form and several thousand records that will be filtered. See...
3
by: ranga044 | last post by:
Hi Guys, I'm implementing a system these days, i want to implement a combo box selection process but i don't know how to implement it, so asking you guys favor? my scenario is this, let's say...
1
by: scottbouley | last post by:
I have a query that queries the work order table by date. I want to be able to query by last 30, 60, or 90 days. I'm using a combo box on my main form to select 30, 60 or 90 days. The bound...
5
by: Haagimus | last post by:
I am trying to create an access form that will have multiple combo box drop downs. There are two that will need to be linked in the form. The selection of the first will need to become the query...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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.