Solved

Orderby syntax in VBA

Posted on 2014-02-07
4
334 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
  • 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

791 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