Solved

Orderby syntax in VBA

Posted on 2014-02-07
4
336 Views
Last Modified: 2014-02-12
Dear experts:
Probably something simple, but the following line is giving me a syntax error when I call it:

Forms!main_form!sfContacts.Form.OrderBy = "status,iif(nz(salesowner_inits,"""")="""",1,0),salesowner_inits,leadtype,surname, forename,companyname,divisionname"

When I remove this bit, it works just fine: iif(nz(salesowner_inits,"""")="""",1,0)

I get an error each time i launch the form.

Any ideas?

Thanks!
0
Comment
Question by:terpsichore
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 33

Expert Comment

by:Norie
ID: 39842908
Is this an expression in the record source of the form?

iif(nz(salesowner_inits,"""")="""",1,0)
0
 

Author Comment

by:terpsichore
ID: 39842973
no, just salesowner_inits is a field in the recordsource

I've used iif clauses in creating an orderby string in VBA in the past, without any problem...
0
 

Accepted Solution

by:
terpsichore earned 0 total points
ID: 39843086
found the problem - when i added square brackets around each term, it worked... strange...
0
 

Author Closing Comment

by:terpsichore
ID: 39852813
see note above. thank you.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question