Grabbing a substring?
Grabbing a substring?
(OP)
I know, i've looked around a bit and I'm not sure how to grab a substing. Maybe there's an easier way to do what i want. I probably could use a little guidance. I made the combobox, but I wasnt sure the best way to translate their selection to the 6 digit date, ie. "January 1, 2014 123112"...i would want to store the 6 digit date into a string for placement on the session screen.
If there's a easier way to assign the variable the six digit date? The 6 digit date does not need to be in the combobox, i.e. when they select "January 1, 2014", a variable would automatically be populated with "123112". That would look cleaner.
I don't know enough to know where to go here.
Thanks in advance.
If there's a easier way to assign the variable the six digit date? The 6 digit date does not need to be in the combobox, i.e. when they select "January 1, 2014", a variable would automatically be populated with "123112". That would look cleaner.
I don't know enough to know where to go here.
Thanks in advance.
CODE --> VB
Dim cboReportDate (12) as string cboReportDate(0) = "January 1, 2014 123112" cboReportDate(1) = "February 1, 2014 013113" cboReportDate(2) = "March 1, 2014 022813" cboReportDate(3) = "April 1, 2014 033113" cboReportDate(4) = "May 1, 2014 043013" cboReportDate(5) = "June 1, 2014 053113" cboReportDate(6) = "July 1, 2014 063013" cboReportDate(7) = "August 1, 2014 073113" cboReportDate(8) = "September 1, 2014 083113" cboReportDate(9) = "October 1, 2014 093013" cboReportDate(10) = "November 1, 2014 103113" cboReportDate(11) = "December 1, 2014 113013" dim yourselection as string Begin Dialog dlgOptions 10, 28, 140, 140, " ---Assignee---" OkButton 80, 17, 45, 20,.btnOK DropComboBox 10, 20, 60, 20, cboReportDate(), .cboReportDate cancelbutton 80, 45, 45, 20, .btnCancel End Dialog iDone = FALSE While (iDone = FALSE) 'This is what this does Dim dlgVar as dlgOptions nRet = Dialog(dlgVar) Select Case nRet Case -1 ' -1 is returned if the user chose OK 'msgbox nRet iDone = TRUE Case 0 ' 0 is returned if the user chose Cancel 'msgbox nRet Exit sub End Select Wend YourSelection = dlgvar.cboreportdate 'dim yourselection as strDate ' msgbox yourselection(18, 6)
RE: Grabbing a substring?
???
Please explain how 123112 translates to jan 1 2014???
It would seem logical to me that the structure of thoese string is probably mmddyy. Using that logic, each of your strings look like they refer to month end dates, so with the exception of the first, which I'd guess should be 123113, and your dates are the first of the next month.
CODE
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Grabbing a substring?
RE: Grabbing a substring?
I also have many reports that will use different date ranges (not always 010100 as start date), so maybe going from the combobox selection to a set of ranges is better and reassigning "yourselection"
RE: Grabbing a substring?
January 1, 2014 1/1/00 to 12/31/12 01/01/13 to 6/30/13 07/01/13 to 07/31/13 7/01/13 to 8/31/13 1/1/00 to 12/31/13
February 1, 2014 1/1/00 to 1/31/13 02/01/13 to 07/31/13 08/01/13 to 08/31/13 8/1/13 to 9/30/13 1/1/00 to 1/31/14
March 1, 2014 1/1/00 to 2/28/13 03/01/13 to 8/31/13 09/01/13 to 09/30/13 9/1/13 to 10/31/13 1/1/00 to 2/28/14
April 1, 2014 1/1/00 to 3/31/13 04/01/13 to 09/30/13 10/01/13 to 10/31/13 10/1/13 to 11/30/13 1/1/00 to 3/31/14
May 1, 2014 1/1/00 to 4/30/13 05/01/13 to 10/31/13 11/01/13 to 11/30/13 11/1/12 to 12/31/13 1/1/00 to 4/30/14
June 1, 2014 1/1/00 to 5/31/13 06/01/13 to 11/30/13 12/1/13 to 12/31/13 12/1/13 to 1/31/14 1/1/00 to 5/31/14
July 1, 2014 1/1/00 to 6/30/13 07/01/13 to 12/31/13 01/01/14 to 1/13/14 1/1/14 to 2/28/14 1/1/00 to 6/30/14
August 1, 2014 1/1/00 to 7/31/13 08/01/13 to 01/31/14 2/1/14 to 2/28/14 2/1/14 to 3/31/14 1/1/00 to 7/31/14
September 1, 2014 1/1/00 to 8/31/13 09/01/13 to 02/28/14 3/1/14 to 3/31/14 3/1/14 to 4/30/14 1/1/00 to 8/30/14
October 1, 2014 1/1/00 to 9/30/13 10/01/13 to 03/31/14 4/1/14 to 4/30/14 4/1/14 to 5/31/14 1/1/00 to 9/30/14
November 1, 2014 1/1/00 to 10/31/13 11/30/13 to 04/30/14 5/1/14 to 5/31/14 5/1/14 to 6/30/14 1/1/00 to 10/31/14
December 1, 2014 1/1/00 to 11/30/13 12/31/13 to 05/31/14 6/1/14 to 6/30/14 6/1/13 to 7/31/14 1/1/00 to 11/30/14
These are my ranges I'm working with. And what I'm doing is trying to make it all automated. Does that help explain?
RE: Grabbing a substring?
CODE --> aa
RE: Grabbing a substring?
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Grabbing a substring?
RE: Grabbing a substring?
Just Dim MyDate
with no variable type
Skip,
Just traded in my OLD subtlety...
for a NUance!