473,387 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

The following code works for the first and last statements only. What wrong?

Expand|Select|Wrap|Line Numbers
  1. Private Sub Request_Amt_AfterUpdate()
  2.  
  3.         If Me.Request_Amt <= "500.00" Then
  4.  
  5.                 Me.Requires_Auth_Level.Value = "Project Coordinator"
  6.  
  7.         ElseIf Me.Request_Amt > "500.00" And Me.Request_Amt <= "1000.00" Then
  8.  
  9.                 Me.Requires_Auth_Level.Value = "Assoc. Project Manager"
  10.  
  11.         ElseIf Me.Request_Amt > "1000.00" And Me.Request_Amt <= "2500.00" Then
  12.  
  13.                 Me.Requires_Auth_Level.Value = "Sr Project Manager"
  14.  
  15.         ElseIf Me.Request_Amt > "2500.00" And Me.Request_Amt <= "5000.00" Then
  16.  
  17.                 Me.Requires_Auth_Level.Value = "Delivery Director"
  18.  
  19.         ElseIf Me.Request_Amt > "5000.00" Then
  20.  
  21.                 Me.Requires_Auth_Level.Value = "National Director"
  22.  
  23.         Else
  24.         MsgBox "The amount requested exceeds your authorization level. Please send an email to the appropriate manager to request authorization and have that response emailed to ???."
  25.  
  26.         End If
  27. End Sub
Nov 7 '10 #1
2 1635
Stewart Ross
2,545 Expert Mod 2GB
You are comparing the request amount to text values, not numbers, in what you show above. This will not behave as you expect it to, as text ordering of numeric values is not the same as numeric ordering. Your Elseifs will not work the same way on such text values as you think they should.

I'd suggest something like this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Request_Amt_AfterUpdate()
  2.  
  3.         If Me.Request_Amt <= 500 Then
  4.  
  5.                 Me.Requires_Auth_Level.Value = "Project Coordinator"
  6.  
  7.         ElseIf Me.Request_Amt > 500 And Me.Request_Amt <= 1000 Then
  8. ...
-Stewart
Nov 7 '10 #2
Thanks - it works.
Nov 7 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Marlon | last post by:
<! -- Web.config--> <authentication mode="Windows" /> <identity impersonate="true" /> <! -- Web.config--> where Configurations.ADsUsersPath is...
3
by: Materialised | last post by:
I am having some issues with the following code, basically what I am trying to do, is familierise myself with compiler warnings, when I try to access a private or protected class function. Here is...
0
by: K B | last post by:
I'm using ASP.NET 2.0 and am still struggling. I use the following code to reorder items in a listbox. When complete, a Save button saves each item to a database. Works fine for the first click...
2
by: Tony Ciconte | last post by:
Does anyone know of or have any VBA code or similar logic that can help distinguish similar first/last name combinations? For example, we would like to prompt the user of a possible match when any...
8
by: Roger | last post by:
I have a question regarding the behaviour of sql with OR and fetch first 1 rows only : I have a table with data : ACNO NAME TELNO CITY ZIP 1000 ...
16
by: Ravi | last post by:
main() { float a = 5.375; char *p; int i; p = (char*)&a; for(i=0;i<=3;i++) printf("%02x",(unsigned char)p); } the above code gives the binary representation of a.
6
by: smoitra | last post by:
Hi All, I am new here.I have a textbox in my form where user is supposed to enter zip codes and as soon they enter that and press tab or click elsewhere on the form it is supposed to go to...
6
by: CSharper | last post by:
I have following code, if you cut and paste it in VS and compile it you see only an answer of 0. I was expecting values from o through 2999 using System; using System.Collections.Generic;...
7
by: khatarnakkhatri | last post by:
<html> <body> <table style="height:100%;width:100%;table-layout:fixed;" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="height:15px;width:100%;background-color:green;"> ...
2
by: Paxton Sanders | last post by:
Does anyone know why the following code successfully labels (with ) entries in the current directory, but not in any other directory? (All other directories' entries print .) I'm using Python...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.