Quarter Declaration

alkrm

Registered User.
Local time
Today, 02:37
Joined
Aug 13, 2003
Messages
39
Can any one help with this:
i havetext box where the user enter the quarter and year , and he ll get the report . there are two conditions, if the report is before the 3rd Quarter 2004 Report1 has to show, if after Q3 2003 then Report2 Has to show.

am stuck with the Quarter Declaration.as the user will input for example "q4 2002"

this code am using for the command button


Dim befor As String
Dim after As String
Dim s As Date

before = "Report1"
after = "Report2"

s = q3 2004 'My Problem

If Forms!quarter!Text1 < s Then
DoCmd.OpenReport before, acPreview
ElseIf Forms!quarter!Text1 >= s Then
DoCmd.OpenReport after, acViewPreview
End If
 
Since your input is text, a simple "greater than" test probably won't work. Your input is really a string, not a date, so you'll have to declare s as a string. Also, is there a typo here or what happens with Q1 2004? It (and others) are both before Q3 2004 and after Q3 2003. I'm going to assume that those are supposed to be the same year, so try something like this, which worked in a test for me:

Code:
  Dim s  As String
  s = InputBox("Enter quarter")
  If Left(s, 2) > "Q3" And Right(s, 4) >= 2004 Then
    MsgBox "after"  'DoCmd.OpenReport After, acPreview
  Else
    MsgBox "before"  'DoCmd.OpenReport Before, acViewPreview
  End If
 
great help

pbaldy,,, thanks for your great help.
i got the concept. now it is matter of logic and , or..


Thanks Alot
 

Users who are viewing this thread

Back
Top Bottom