?
Solved

System Settings and textboxes

Posted on 1999-01-18
3
Medium Priority
?
163 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Accepted Solution

by:
rondeauj earned 100 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 70

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month12 days, 12 hours left to enroll

777 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