Solved

Orderby syntax in VBA

Posted on 2014-02-07
4
316 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
Comment Utility
Is this an expression in the record source of the form?

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

Author Comment

by:terpsichore
Comment Utility
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
Comment Utility
found the problem - when i added square brackets around each term, it worked... strange...
0
 

Author Closing Comment

by:terpsichore
Comment Utility
see note above. thank you.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now