473,395 Members | 1,968 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,395 software developers and data experts.

COmbo boxes

77
One more question:

I have a combo box called Period, which taken inputs from users for the period of subscription. The maximum period for subscription is 3 years.

I also have another combo showing Months called subscription start month and a text box wich displays the current year.

The user selects the period of subscription and the start month from the combo,
the application should automatically display the end month in the field subscription end month and the end year in the text box subcription end year

Thanks in advance
Sajit

--------------------------------------------------------------------------------
Feb 15 '08 #1
9 1339
Delerna
1,134 Expert 1GB
If period is in whole years only. ie 1 2 or 3 years
then calculate the number of months ie period*12 and continue as below
If period is in months then leave period as it is

make a date from startyear and startmonth
and add period to it and then separate the year and month again

and then set the combo boxes so the correct values are selected
Feb 17 '08 #2
sajitk
77
Dear Delerna,

Thanks for the reply....Can you just elaborate on this....i just didnt understand...

Sajit

If period is in whole years only. ie 1 2 or 3 years
then calculate the number of months ie period*12 and continue as below
If period is in months then leave period as it is

make a date from startyear and startmonth
and add period to it and then separate the year and month again

and then set the combo boxes so the correct values are selected
Feb 18 '08 #3
missinglinq
3,532 Expert 2GB
How do the months appear in your Months combobox, i.e. Jan, Feb, Mar
or
January, February, March

or
01, 02, 03

Which of the above formats do you want the month to have in the subscription end month field?

What values are in the Period combobox; months or years? Are they formatted as 1, 2, 3 or One, Two, Three?

Linq ;0)>
Feb 18 '08 #4
Delerna
1,134 Expert 1GB
sorry, assuming
period is in months
StartYear is "2008"
StartMonth is "03" (march)

what i meant was

make a date from StartYear and StartMonth
StartDte=cDate("01/" & StartMonth & "/" & StartYear) so Dte= 01/03/2008

now add the period to that date
EndDte=DateAdd("m",Period,StartDte) if period=13 then Dte=01/04/2009

Now split the year and month for the display controls
EndYear=Year(EndDte)
EndMonth=Month(EndDte)

Now just set the controls to those values.

Hope that helps
Feb 18 '08 #5
missinglinq
3,532 Expert 2GB
make a date from StartYear and StartMonth
StartDte=cDate("01/" & StartMonth & "/" & StartYear) so Dte= 01/03/2008

now add the period to that date
EndDte=DateAdd("m",Period,StartDte) if period=13 then Dte=01/04/2009
You need to keep in mind, delerna, when doing this sort of thing with dates, that much of the civilized world uses a default date format of mm/dd/yyyy. Using your code on a PC in any of these countries will always result in a StartDte and EndDte in the month of January!

Linq ;0)>
Feb 18 '08 #6
Delerna
1,134 Expert 1GB
correction
make a date from StartYear and StartMonth
StartDte=cDate(StartMonth & "/01/" & StartYear) so Dte= 03/01/2008

now add the period to that date
EndDte=DateAdd("m",Period,StartDte) if period=13 then Dte=04/01/2009
Feb 18 '08 #7
missinglinq
3,532 Expert 2GB
Dealing with dates in an international forum is always a hairball! And we still need the answers to the questions I posed earlier! If StartMonth is Jan or January instead of 1 or 01 then it'll have to be parsed into 01 before being plugged into your formula. We also need the answer to whether Period is in months or years.

Linq ;0)>
Feb 18 '08 #8
sajitk
77
Sorry for the late reply


the months appear as January, February etc.....

The period appear as 1, 2, 3 respectively

Sajit

How do the months appear in your Months combobox, i.e. Jan, Feb, Mar
or
January, February, March

or
01, 02, 03

Which of the above formats do you want the month to have in the subscription end month field?

What values are in the Period combobox; months or years? Are they formatted as 1, 2, 3 or One, Two, Three?

Linq ;0)>
Feb 19 '08 #9
missinglinq
3,532 Expert 2GB
Three final questions:

I'm assuming that a one year subscription is 12 issues, and if it starts in January 2008 then it will end in December 2008. Is this correct?

Period is in years, correct?

Your PC's Regional Settings are for the USA, correct? Which is to say the default Date format would be mm/dd/yyyy.

If all of the above are true, then this should do the job:

Expand|Select|Wrap|Line Numbers
  1. Private Sub StartMonth_AfterUpdate()
  2.   StartDate = Me.StartMonth & " " & " 01 " & Me.StartYear
  3.   EndDate = DateAdd("m", (Me.Period * 12) - 1, StartDate)
  4.   Me.EndMonth = Format(EndDate, "mmmm")
  5.   Me.EndYear = Year(EndDate)
  6. End Sub
  7.  
If all of the above are not correct, post back and we'll make adjustments.

Linq ;0)>
Feb 19 '08 #10

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

Similar topics

3
by: vgrssrtrs | last post by:
<html> <head> <script language="JavaScript"> <!-- /* *** Multiple dynamic combo boxes *** by Mirko Elviro, 9 Mar 2005 *** ***Please do not remove this comment
1
by: FZ | last post by:
Hi Gang, I was wondering if a generous person might be able to walk me through what I believe is a pretty simple task. I actually have significant Access experience, but I haven't done it in...
0
by: Krisa | last post by:
Hello all, I just discovered something (stop me if you've heard this before....) that was causing me a significant performance hit when opening a form with subforms. To speed up loading the...
0
by: Tom | last post by:
I have some very strange issues with combo boxes on a tab control. Here's the scenario: I have a Windows Forms form that has a tab control on it, with two (2) tabs. Tab 2 happens to have a number...
5
by: jjyconsulting | last post by:
Newbie needing some help. I have a tblParticipants. The fields include gender, education_level, income, occupation etc., I'm trying to create a form where a user can run a query from the form and...
4
by: Dave | last post by:
I wasn't sure how to search for previous posts about this, it felt real specific. Ok so here's the database & problem: I have 4 combo boxes: cboServer, cboPolicy, cboDB, and cboApplication. ...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
1
by: Dave | last post by:
Hello all, First I'd like to apologize...This post was meant to be put in my previous post, but I tried many times without success to reply within my previous post. Now here goes... I have a...
2
by: Dave | last post by:
I have 3 tables of information feeding into 4 combo boxes on my main form (DR Form). I have as many list boxes (acting as text boxes) as there are fields in each one of the 3 tables. Once...
2
by: someshbakliwal | last post by:
Hi, I have created some autopopulating combo boxes on my HTML page (script- Javascript). so these combo boxes are autopopulated with choices made in previous combo boxes. The problem I am facing is...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
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,...

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.