Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to do it as an Array?

Status
Not open for further replies.

DonP

IS-IT--Management
Jul 20, 2000
684
US
I'm sure this must be simpler as an array rather than with eleven ElseIf statements, but don't have a clue how to do it. I've never done an array before. It works fine as it is, but I would like to learn. Can someone help? This is using an Access database, by the way. Thanks!

Code:
<%
If DoVar(rs(&quot;Date&quot;)) = &quot;&amp;nbsp;&quot; then
FullDate = (&quot;There was no date specified&quot;)
Else
Dim dDate
dDate = DoVar(rs(&quot;Date&quot;))
Year(dDate)&amp; Day(dDate) &amp; Month(dDate)
If Month(dDate) = &quot;1&quot; then
   MonthVar = &quot;January&quot;
ElseIf Month(dDate) = &quot;2&quot; then
   MonthVar = &quot;February&quot;
ElseIf Month(dDate) = &quot;3&quot; then
   MonthVar = &quot;March&quot;
ElseIf Month(dDate) = &quot;4&quot; then
   MonthVar = &quot;April&quot;        
ElseIf Month(dDate) = &quot;5&quot; then
   MonthVar = &quot;May&quot;
ElseIf Month(dDate) = &quot;6&quot; then
   MonthVar = &quot;June&quot;
ElseIf Month(dDate) = &quot;7&quot; then
   MonthVar = &quot;July&quot;         
ElseIf Month(dDate) = &quot;8&quot; then
   MonthVar = &quot;August&quot;
ElseIf Month(dDate) = &quot;9&quot; then
   MonthVar = &quot;September&quot; 
ElseIf Month(dDate) = &quot;10&quot; then
   MonthVar = &quot;October&quot;    
ElseIf Month(dDate) = &quot;11&quot; then
   MonthVar = &quot;November&quot; 
ElseIf Month(dDate) = &quot;12&quot; then
   MonthVar = &quot;December&quot; 
End if
FullDate = ((MonthVar) &amp; &quot; &quot; &amp; Day(dDate) &amp; &quot;, &quot;&amp; Year(dDate))
End if
%>

Don
don@ctagroup.org
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT (only when I have to!)
 
Don,

Try this...
Code:
Dim dDate: dDate = Now()
Dim dMonth: dMonth = Month(dDate)
Dim arrMonth: arrMonth = Array(&quot;null&quot;, &quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;, &quot;Jul&quot;, &quot;Aug&quot;, &quot;Sep&quot;, &quot;Oct&quot;, &quot;Nov&quot;, &quot;Dec&quot;)
Response.Write dMonth &amp; &quot; - &quot; &amp; arrMonth(dMonth) &amp; &quot;<br>&quot;
Later, Rob
robschultz@yahoo.com
-Focus on the solution to the problem, not the obstacles in the way.-
 
Looks like it will do the trick, but I can't try it until the morning as I don't have the code here. Apparently I had the right idea when I tried it, but had missed something in the syntax. Thanks a bundle!

Don
don@ctagroup.org
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT (only when I have to!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top