Results 1 to 2 of 2
  1. #1
    Elio is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    May 2018
    Posts
    1

    SWITCH Function SYNTAX

    Hi i'm new in the forum, thank you in advance.

    I'm tryng to use Switch function but it gives me back Syntax error.


    And i can't find the problem.
    Somebody can help me?

    Switch(
    [DN]<32, "Art 4.3",
    [DN]>32 and 0<[DN*PS]<1000 ), "Art 4.3",
    32<[DN]<100 and 1000<[DN*PS]<3500 , " Cat 1",
    100<[DN]<250 and 3500<[DN*PS]<5000 , " Cat 2",
    [DN]>250 and [DN*PS]>5000 , " Cat 3"
    )

    He says:
    The Expression you entered contains invalid syntax.
    You may have entered an operand without an operator.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    You have a field named DN*PS

    Really should not use punctuation/special characters (underscore only exception) in naming convention.

    Maybe:
    Switch([DN]<32 Or ([DN]>32 And 0<[DN*PS] And [DN*PS]<1000), "Art 4.3",
    32<[DN] And [DN]<100 And 1000<[DN*PS] And [DN*PS]<3500 , "Cat 1",
    100<[DN] And [DN]<250 And 3500<[DN*PS] And [DN*PS]<5000 , "Cat 2",
    [DN]>250 and [DN*PS]>5000, "Cat 3"
    )
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. simple Switch function question
    By billybeer in forum Reports
    Replies: 3
    Last Post: 10-31-2017, 11:37 AM
  2. Replies: 12
    Last Post: 05-14-2017, 10:11 AM
  3. Alernative to SWITCH function???
    By elender in forum Queries
    Replies: 5
    Last Post: 02-09-2017, 06:54 PM
  4. Using SQL switch function MS Access
    By sandlucky in forum Queries
    Replies: 18
    Last Post: 03-31-2011, 08:49 AM
  5. Select Query in Switch Function
    By sandlucky in forum Queries
    Replies: 0
    Last Post: 03-30-2011, 04:54 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums