I have a form that runs some sql on the form load and three sort buttons on the form that all repeat the sql in their own private function. The only difference is the sort order. When I need to update the where clause, I have to update it 4 times. I would like to created a parameterized function like

```
function getFormRecs(arg){
    sql...
    . 
    .
    .
    order by 'arg'
{

```

where arg is the argument passed in from the form control or event.

Then I would like the form load and the 3 sort buttons on the form to call the function getFormRecs(), while passing in the arg, like

```
getFormRecs('formload')
getformRecs('sorta')
getformRecs('sortb')
getformRecs('sortc')

```

I would define the correct sort field in the top of the function based on the arg passed in.

The end result is simply to reuse a function or Sub-routine that contains nearly identical long winded sql.