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
Solved

Access 2010 Where Condition on a DoCmd OpenForm

Posted on 2014-10-29
5
222 Views
Last Modified: 2014-10-29
I need to combined these together and separated with OR for a WHERE CONDITION on a DoCmd OpenForm.

'2
    stLinkCriteria2 = "[RoutedTo] like '???/" & txtCategoryList & "*'"
    stLinkCriteria2a = stLinkCriteria2 & " And [AllItemCal2] is Null"
'3
    stLinkCriteria3 = "[RoutedTo] like '???/???/" & txtCategoryList & "*'"
    stLinkCriteria3a = stLinkCriteria3 & " And [AllItemCal3] is Null"
'4
    stLinkCriteria4 = "[RoutedTo] like '???/???/???/" & txtCategoryList & "*'"
    stLinkCriteria4a = stLinkCriteria4 & " And [AllItemCal4] is Null"

In other words, I should end up with something like...

stLinkCriteria = stLinkCriteria2a OR stLinkCriteria3a OR stLinkCriteria4a

Can someone help me with the syntax.

Thanks in advance!
0
Comment
Question by:Senniger1
  • 2
  • 2
5 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 40410515
you are going to need to wrap your individual critieria in () .

stLinkCriteria2a = "(" & stLinkCriteria2 & " And [AllItemCal2] is Null)"
stLinkCriteria3a = "(" & stLinkCriteria3 & " And [AllItemCal3] is Null)"
stLinkCriteria4a = "(" & stLinkCriteria4 & " And [AllItemCal4] is Null)"

Then, your syntax of :

stLinkCriteria = stLinkCriteria2a OR stLinkCriteria3a OR stLinkCriteria4a

should work
0
 

Author Comment

by:Senniger1
ID: 40410536
I'm getting a Run-time error 13:  type mismatch.

Shouldn't the following line be formatted some way as well?
stLinkCriteria = stLinkCriteria2a OR stLinkCriteria3a OR stLinkCriteria4a

Thanks!
0
 
LVL 50

Expert Comment

by:Rgonzo1971
ID: 40410548
pls try

stLinkCriteria = stLinkCriteria2a & " OR  " & stLinkCriteria3a & " OR  " & stLinkCriteria4a
0
 

Author Closing Comment

by:Senniger1
ID: 40410561
Perfect!
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 40410564
Yes, like Rgonzo says.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

792 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