Results 1 to 6 of 6
  1. #1
    nnaxor is offline Novice
    Windows Vista Access 2002
    Join Date
    Aug 2016
    Posts
    3

    Simple If/Then Problem


    I am having trouble with a simple If/Then statement in my database. Can you help me figure out what I am doing wrong?

    Code:
     
    Private Sub Red_Amt_AfterUpdate()
     
        [RBAAmt] = [RedAmt] IF [Request] = "Personal" * 0.90 Else * 0.25 END IF
    End Sub
    Thanks for your help, I'm sure it is something basic I just can't see it.

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Please explain what your formula is supposed to do.

    The syntax is:
    Code:
    Private Sub Red_Amt_AfterUpdate()
       IF [Request] = "Personal" THEN
         [RBAAmt] = [RedAmt] * 0.90
      Else 
         [RBAAmt] = [RedAmt]* 0.25 
      END IF
    End Sub
    Is this close???

  3. #3
    nnaxor is offline Novice
    Windows Vista Access 2002
    Join Date
    Aug 2016
    Posts
    3
    I think so I'll try it - basically if a field has the word Personal in it instead of a number I need the number multiplied by 90%, if it has a number I need it multiplied by 25% - going to try your suggestion now

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    a field has the word Personal in it instead of a number
    You do realize that a field that has "Personal" stored in it is a TEXT type field. If you store 12345 in that field, it is TEXT, not a number??

  5. #5
    nnaxor is offline Novice
    Windows Vista Access 2002
    Join Date
    Aug 2016
    Posts
    3
    Yes I do know that but thank you in case I didn't. The numbers need to be treated as text in this case; your solution worked beautifully. Thanks so much!

  6. #6
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You're welcome.......

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

Similar Threads

  1. simple syntax problem
    By markjkubicki in forum Programming
    Replies: 5
    Last Post: 09-15-2015, 12:00 PM
  2. Help With What Is (Probably) A Simple Problem
    By shoelesscraig in forum Access
    Replies: 23
    Last Post: 08-25-2015, 11:45 AM
  3. Simple Subform Problem
    By whooke in forum Forms
    Replies: 2
    Last Post: 09-27-2014, 02:56 PM
  4. Very simple problem
    By alexc333 in forum Queries
    Replies: 8
    Last Post: 07-21-2011, 07:35 AM
  5. Simple Problem with Validations
    By oleBucky in forum Forms
    Replies: 11
    Last Post: 04-12-2011, 05:39 PM

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