RLN wrote:
> RE: Access 2003
>
> I have a SQL variable (strSQL1 dimmed as String) that gets built using
> Select Case logic. The first half of strSQL1 is etched in stone no
> matter what.
> The 2nd half of strSQL1 (the condition) is built depending on which
> option button is chosen:
> For option 1, I add "Condition X" to the end of strSQL1.
> For option 2, I add "Condition Y" to the end of strSQL1...etc.
>
> When the Select Case logic is completed strSQL1 is built and I then need
> to launch a form in Datasheet mode using strSQL1 as my data source.
>
> Can this be done?
>
>
> *** Sent via Developersdex http://www.developersdex.com
***
I suppose you could launch and change the source.
DoCmd.OpenForm "FormName", , , , , , strSQL1
Now in the OnOpen even you could do
If Not IsNull(me.openargs) then Me.Recordsource = Me.OpenArgs
But I don't see the necessity because the table info isn't
changing...just the filter. Let's say you simply make strSQL1 the
conditional then pass the filter. Ex:
strSQL1 = "customerid = 123".
DoCmd.OpenForm "FormName", , , strSQL1
and this will open it to filtered records where customerid = 123
Once in a form, you could do things like this
Me.Filter = "CustomerID = 123"
Me.FilterOn = True
Powerful
http://www.youtube.com/watch?v=YhrLBrDzj5Q


|