IF THEN ELSE Query...

Happy New Year All!

I have 2 queries, a qry_HISTData and qry_RAWData. qry_RAWData is
automatically triggered from a subform using the "asofdate" of the
mainform as a date parameter. What I'm attempting is to have the
subform trigger qry_HISTData when the mainform's "asofdate" is older
than the current date. Is this possible? If so how? I thought
perhaps using IF THEN ELSE but I am unfamiliar with how to do this
using SQL. Any help is appreciated. Thank you.
AccessGuy [ Do, 03 Januar 2008 21:04 ] [ ID #1898826 ]

Re: IF THEN ELSE Query...

AccessGuy wrote:
> Happy New Year All!
>
> I have 2 queries, a qry_HISTData and qry_RAWData. qry_RAWData is
> automatically triggered from a subform using the "asofdate" of the
> mainform as a date parameter. What I'm attempting is to have the
> subform trigger qry_HISTData when the mainform's "asofdate" is older
> than the current date. Is this possible? If so how? I thought
> perhaps using IF THEN ELSE but I am unfamiliar with how to do this
> using SQL. Any help is appreciated. Thank you.

I suppose you could put code similar to the following in the AfterUpdate
event of AsOfDate.

Dim strSource As String
strSource = IIF(Me.AsOfDate <=- Date(),"qry_RAWData","qry_HISTData")
Forms!MainFormName!SubFormName.Form.Recordsource = strSource

Palm trees
http://www.youtube.com/watch?v=J0oyIPXvw5w
Salad [ Do, 03 Januar 2008 21:54 ] [ ID #1898831 ]
Datenbanken » comp.databases.ms-access » IF THEN ELSE Query...

Vorheriges Thema: Visual Basic Not Waiting for Query to fully evaluate???
Nächstes Thema: Access 2007 and Outlook Contacts