|
-
Sep 9th, 2008, 12:48 PM
#1
Thread Starter
Member
[RESOLVED] problem comparing values
Hi everyone,
I am trying to read in a string containing numerical values and keep a running total of a field. The field contains values such as 000001.15 (preceeding zeros and 2 decimal points.)
my declarations are as follows
Dim runTotal_NetPaid_GT_ZERO(6) As Currency
Dim netPaid As Currency
netPaid = CCur(SH_NetPaid) ' field which contains the string
The problem I have is when I use "netPaid" to make a comparison.
Select Case netPaid
Case netPaid = 0
Case netPaid > 0
Case Else
End Select
Even though the value is zero in Debug, the highlighted code does not get executed. Any ideas on why this is?
Thanks for your help
Gogi
-
Sep 9th, 2008, 12:57 PM
#2
Re: problem comparing values
It is because you aren't using the Select Case quite right - the variable should only appear on the first line of it, and not on the actual Case's.
-
Sep 9th, 2008, 12:57 PM
#3
Re: problem comparing values
also check this for me...
Insert this line
Code:
MsgBox Format(netPaid, "$#,##0.00")
before the
Code:
Select Case netPaid
and tell me what do you get?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Sep 9th, 2008, 01:18 PM
#4
Thread Starter
Member
Re: problem comparing values
Hi
Thanks for the reply guys.
koolsid:
MsgBox Format(netPaid, "$#,##0.00") this gives me $14.00
netPaid = CCur(SH_NetPaid) gives me 14
which is why I thought 000000.00 will give me 0 therefore that select case should work.
si_the_geek:
I see your point, but how will I deal with values greater than 0. will this work
Case Is > 0. I suppose I should try, shouldn't I?
Thanks
-
Sep 9th, 2008, 01:22 PM
#5
Re: problem comparing values
Case Is > 0. I suppose I should try, shouldn't I?
Yes you are right...
Code:
Select Case netPaid
Case 0
'your code
Case Is > 0
'your code
Case Else
'your code
End Select
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Sep 9th, 2008, 01:26 PM
#6
Thread Starter
Member
Re: problem comparing values
Thanks for your hel guys, I can go home know.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|