Hey guys,
I have a query for which I need to adjust the where clause programtically depending on a value the user selects from a form. I just need a little help with the syntax. Could somebody just give a general example of how this could be done.
So in psuedocode:
Strsql = "SELECT...." [green] 'I think I can do all this without problem [/green]
If Condition 1 then
Strsql = Strsql & "WHERE Criteria 1..."
Else
Strsql = Strsql & "Where Criteria 2..."
End if
Set MyQuery based on Strsql [green] 'This is what I'm not sure how to do [/green]
Sorry I know this is basic and that there are many examples of this throughout the forums, but I'm new to this and wasn't sure exactly which method was best to use.
Thanks for the help,
Collen
I have a query for which I need to adjust the where clause programtically depending on a value the user selects from a form. I just need a little help with the syntax. Could somebody just give a general example of how this could be done.
So in psuedocode:
Strsql = "SELECT...." [green] 'I think I can do all this without problem [/green]
If Condition 1 then
Strsql = Strsql & "WHERE Criteria 1..."
Else
Strsql = Strsql & "Where Criteria 2..."
End if
Set MyQuery based on Strsql [green] 'This is what I'm not sure how to do [/green]
Sorry I know this is basic and that there are many examples of this throughout the forums, but I'm new to this and wasn't sure exactly which method was best to use.
Thanks for the help,
Collen