|
#1
|
|||
|
|||
|
Sting or Long? not sure advice please
Hi,
can someone please check the below for me and let me know if I am using the right data types at the moment I have them like this Public ValueTendered As String Public TotalTendered As String should they be Public ValueTendered As Long Public TotalTendered As Long They are numbers (part of a tender tracking module for the cash drawer) This is the code I am calling when ever a tender is done If Val(TotalTendered) >= Val(SubTotalValue) Then Call ModuleFunction If Val(TotalTendered) < Val(SubTotalValue) Then TotalToPay = SubTotalValue - TotalTendered TotalToPay = Format(TotalToPay, "######0.00") FrmTenderScreen.LabUserMessages.Alignment = 0 FrmTenderScreen.LabUserMessages.Alignment = 0 FrmTenderScreen.LabUserMessages.Caption = " TENDERED " & DisplayTender & TotalTendered & vbNewLine & " TO PAY " & DisplayTender & TotalToPay Call TotalToPayment If FrmTenderScreen.Visible = True Then FrmTenderScreen.Enabled = True FrmTenderScreen.SetFocus End If If FrmDepositScreen.Visible = True Then FrmDepositScreen.Enabled = True FrmDepositScreen.SetFocus End If End If It works every time with cash payments and gift cards but if you mix a credit card payment it does not work. I have to enter 0 CASH about 5-10 times before it will function and end the transacation. And in a EPoS software this is not a good thing. I would welcome any advice, commets you guys can give me Thanks |
|
#2
|
||||
|
||||
|
Numbers should be a numeric data type:
Integer Long Double Single Which one depends on how large a number will be stored in the variable. Alpha characters should be a string.
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section. ![]() Please use [Code]your code goes in here[/Code] tags when posting code. Before posting your question, did you look here? Got a question on Linux? Visit our Linux sister site. Modifications Required For VB6 Apps To Work On Vista ![]() Microsoft MVP 2005/2006/2007/2008/2009 |
|
#3
|
|||
|
|||
|
The max it will hold is 999999.99
would taht be long or Interger? |
|
#4
|
||||
|
||||
|
Yes, that would be too much for an Integer.
Integer = 16 bit number ranging from -32,768 to 32,768 Long = 32 bit number ranging from -2,147,483,648 to 2,147,483,648 Single = 32-bit number ranging from -3.402823e38 to -1.401298e-45 for negative values and from 1.401298e-45 to 3.402823e38 for positive values. When you need fractional numbers within this range, this is the data type to use. Double = 64-bit floating point number used when high accuracy is needed. These variables can range from -1.79769313486232e308 to -4.94065645841247e-324 for negative values and from 4.94065645841247e-324 to 1.79769313486232e308 for positive values. I would think a Long would be the data type you would need for this particular instance.
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section. ![]() Please use [Code]your code goes in here[/Code] tags when posting code. Before posting your question, did you look here? Got a question on Linux? Visit our Linux sister site. Modifications Required For VB6 Apps To Work On Vista ![]() Microsoft MVP 2005/2006/2007/2008/2009 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Search System Tray | MyPlague | .NET | 2 | 03-20-2006 06:18 PM |
| AnimateWindow API | Tim Manos | VB Classic | 4 | 10-19-2001 07:06 AM |
| How do I detect an FTP timeout? | Julian Milano | VB Classic | 2 | 08-11-2000 01:11 PM |
| How do I detect an FTP timeout? | Julian Milano | VB Classic | 0 | 08-10-2000 10:16 PM |
| Trying to print a PDF File from VB | Kunal Sharma | VB Classic | 2 | 04-25-2000 04:45 PM |