|
-
Feb 27th, 2001, 03:15 PM
#1
Thread Starter
PowerPoster
How do I correctly check the current date against a preset date in the future and based on that call this function EarlyPrice or the other function RegPrice?
Here is what I have:
Dim MyDate
Mydate = Date ' will return system date
If MyDate <= ' the rest is a clue to me!
-
Feb 27th, 2001, 03:29 PM
#2
Frenzied Member
<!--blur--!>
hummm not sure what you are asking
you can use dateDiff("d",date1,date2)
d :day
m:month
y:year
-
Feb 27th, 2001, 03:29 PM
#3
If MyDate <= "12/01/2000"
or whatever date you choose.
-
Mar 6th, 2001, 01:34 PM
#4
Thread Starter
PowerPoster
What can I do to check against March 31, 2001?
Whenever I use this code for setting the current system date less than or equal to the date below it doesn't recognize this format.
What can I do to check against March 31, 2001?
MyDate = Date
MyDate <= "03/31/2001"
-
Mar 6th, 2001, 01:35 PM
#5
Thread Starter
PowerPoster
Whenever I use this code for setting the current system date less than or equal to the date below it doesn't recognize this format.
What can I do to check against March 31, 2001?
MyDate = Date
MyDate <= "03/31/2001"
-
Mar 6th, 2001, 02:03 PM
#6
Fanatic Member
Cander's suggestion should work just fine. Just make sure you Dim MyDate as Date.
Code:
Option Explicit
Private Sub Command1_Click()
Dim myDate As Date
myDate = Now() ' or myDate = Date()
If myDate <= "03/31/2001" Then
MsgBox "Less than target date"
End If
End Sub
-
Mar 6th, 2001, 02:16 PM
#7
Thread Starter
PowerPoster
thanks, the now() works but what is wrong with my code here?
I am trying to call either one function or the other function : It doesn't work
Dim MyDate as Date
MyDate = Now()
Code:
If MyDate <= "3/31/2001" Then
EarlyPrice()
Else
RegPrice()
-
Mar 6th, 2001, 02:24 PM
#8
Fanatic Member
Using your code, I put msgboxes in place of your function calls. The If...Then appears to be working fine.
Are your functions declared correctly ?
Code:
Option Explicit
Private Sub Command1_Click()
Dim MyDate As Date
MyDate = Now()
If MyDate <= "3/31/2001" Then
MsgBox "MyDate is less than or equal to 3/31/2001"
'EarlyPrice()
Else
MsgBox "MyDate is greater than 3/31/2001"
'RegPrice()
End If
End Sub
-
Mar 6th, 2001, 02:28 PM
#9
Thread Starter
PowerPoster
I forgot to tell you I am writing in Vb Script.
-
Mar 6th, 2001, 02:34 PM
#10
Thread Starter
PowerPoster
Here is the function. Is it correct?
Code:
<%
Dim intEarlyBird
Function EarlyPrice()
Dim strRegArray(10)
Dim intLoop
Select Case lstReg1Type 'registration type from the first grouping
Case "Individual"
strRegArray(1) = 105
Case "Spouse"
strRegArray(1) = 95
Case "ActivePulpitPastor"
strRegArray(1) = 75
Case "SpecialStudentRate"
strRegArray(1) = 75
Case Else
Response.Redirect "ErrorType.asp"
End Select
Select Case lstReg2Type 'registration type from the second grouping
Case "Individual"
strRegArray(2) = 105
Case "Spouse"
strRegArray(2) = 95
Case "ActivePulpitPastor"
strRegArray(2) = 75
Case SpecialStudentRate
strRegArray(2) = 75
Case Else
Response.Redirect "ErrorType.asp"
End Select
Select Case lstReg3Type 'registration type from the third grouping
Case Individual
strRegArray(3) = 105
Case Spouse
strRegArray(3) = 95
Case ActivePulpitPastor
strRegArray(3) = 75
Case SpecialStudentRate
strRegArray(3) = 75
Case Else
Response.Redirect "ErrorType.asp"
End Select
Select Case lstReg4Type 'registration type from the fourth grouping
Case Individual
strRegArray(4) = 105
Case Spouse
strRegArray(4) = 95
Case ActivePulpitPastor
strRegArray(4) = 75
Case SpecialStudentRate
strRegArray(4) = 75
Case Else
Response.Redirect "ErrorType.asp"
End Select
Select Case lstReg5Type 'registration type from the fifth grouping
Case Individual
strRegArray(5) = 105
Case Spouse
strRegArray(5) = 95
Case ActivePulpitPastor
strRegArray(5) = 75
Case SpecialStudentRate
strRegArray(5) = 75
Case Else
Response.Redirect "ErrorType.asp"
End Select
Select Case lstReg6Type 'registration type from the sixth grouping
Case Individual
strRegArray(6) = 105
Case Spouse
strRegArray(6) = 95
Case ActivePulpitPastor
strRegArray(6) = 75
Case SpecialStudentRate
strRegArray(6) = 75
Case Else
Response.Redirect "ErrorType.asp"
End Select
Select Case lstReg7Type 'registration type from the seventh grouping
Case Individual
strRegArray(7) = 105
Case Spouse
strRegArray(7) = 95
Case ActivePulpitPastor
strRegArray(7) = 75
Case SpecialStudentRate
strRegArray(7) = 75
Case Else
Response.Redirect "ErrorType.asp"
End Select
Select Case lstReg8Type 'registration type from the eigth grouping
Case Individual
strRegArray(8) = 105
Case Spouse
strRegArray(8) = 95
Case ActivePulpitPastor
strRegArray(8) = 75
Case SpecialStudentRate
strRegArray(8) = 75
Case Else
Response.Redirect "ErrorType.asp"
End Select
Select Case lstReg9Type 'registration type from the ninth grouping
Case Individual
strRegArray(9) = 105
Case Spouse
strRegArray(9) = 95
Case ActivePulpitPastor
strRegArray(9) = 75
Case SpecialStudentRate
strRegArray(9) = 75
Case Else
Response.Redirect "ErrorType.asp"
End Select
Select Case lstReg10Type 'registration type from the tenth grouping
Case Individual
strRegArray(10) = 105
Case Spouse
strRegArray(10) = 95
Case ActivePulpitPastor
strRegArray(10) = 75
Case SpecialStudentRate
strRegArray(10) = 75
Case Else
Response.Redirect "ErrorType.asp"
End Select
'-- Sum up the total selections
For intLoop = 1 to 10
intEarlyBird = intEarlyBird + Cint(strRegArray(intLoop))
Next
End Function
%>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|