Solved

System Settings and textboxes

Posted on 1999-01-18
3
146 Views
Last Modified: 2010-05-03
if i do this command:
Str$ = text1.text
with the decimal numeric format of systems settings = "," it doesn't retrieve the right value.
How can i get it right ??
0
Comment
Question by:ttrigo
3 Comments
 
LVL 1

Accepted Solution

by:
rondeauj earned 50 total points
ID: 1469289
1) STR is a VB keyword

2) try this:

 dim tempstring as string
 tempstring = format(text1.text,"#####.##")


0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1469290
Even though Str is a VB Keyword you are allowed to Dim:
Dim Str$

Although I wouldn't recommend it precisely for that reason.

That aside, I do not understand what you are trying to do here:

Str$ = text1.text

I assume that text1 is a text box; in that case, the text property of text1 is a string type property anyway. So you're assigning the value of string text1.text to string Str$

The decimal numeric format of system settings doesn't come into the picture at all.

So, what exactly are you trying to do? Once I understand that, I will be able to sort out your problem for you.

Regards, etc,
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 1469291
Try this function.

'pstrDecimal is a string containing the string representation of your number
Public Function FormatDecimalSQL(ByVal pstrDecimal As String) As String
Const kSep as string = ","
Dim intPos As Integer
   
    intPos = InStr(1, pstrDecimal, kSep)
    If intPos = 0 And Len(pstrDecimal) > 0 Then
        FormatDecimalSQL = pstrDecimal
    ElseIf Len(pstrDecimal) = 0 Then
        FormatDecimalSQL = "0"
    Else
        FormatDecimalSQL = Mid$(pstrDecimal, 1, intPos - 1) & _
                           "." & _
                           Mid$(pstrDecimal, intPos + Len(kSep))
    End If
End Function

Normally,

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now