Another DoCmd.OpenForm Question

  • Thread starter Thread starter Gordon
  • Start date Start date
G

Gordon

Hey All,

I'm trying this and can't seem to make it work.

DoCmd.OpenForm , , , " CCSD LIKE '*something*' ORDER BY [date] "

Is the ORDER BY illegal in this instance?

Thanks,

G
 
AFAIK, yes since the "WhereCondition" argument is expected to be a WHERE
Clause without the word "Where", not an ORDER BY Clause.

If you want to sort the Records, put the ORDER BY Clause in the RecordSource
Query or you can use code to set the OrderBy and OrderByOn Properties of the
Form.

Check Access VB Help on the above 2 Properties.
 
Hey All,

I'm trying this and can't seem to make it work.

DoCmd.OpenForm , , , " CCSD LIKE '*something*' ORDER BY [date] "

Is the ORDER BY illegal in this instance?

Thanks,

G

DoCmd.OpenForm "FormName" , , , "CCSD LIKE '*something*'"
forms!FormName.OrderBy = "DateField"
forms!FormName.OrderByOn = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top