Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Working with recordsets containing commas.

Posted on 2012-03-28
16
Medium Priority
?
275 Views
Last Modified: 2012-03-28
Hello,

I am currently working on an application that has to run in a European Office Environment.  One of the MANY problems I have come across is that the numbers in Europe have commas in decimal places.  

So when I select criteria and pull data from the db, I have a field that contains commas and the remainder of the field is getting placed in the adjacent column.  If you look at the snapshot that I posted, you will see under Origin in the 3rd & 4th row, there is "80 G" and "18 G".  Those values should be in the column to the left, as "3,80 G" and "3, 18 G", respectively.  

Screenshot of list box
How do I stop the splitting from happening?
0
Comment
Question by:pwdells
[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
  • 6
  • 4
  • 2
  • +3
16 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37778376
What is the Row Source Type of this combobox...?
If it is table/query then this should not be an issue...

If it is a "Value List", then try using a semi-colon (;) instead of a comma (,) as the delimiter...
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 37778392
how are you loading this list?

It looks like you have the RowSource type set to value list, and it sounds like you are loading it by looping through the recordset and using the Add method.

Instead, set the RowSourceType to "Table/Query" and select the name of the table or query as the RowSource, rather than the text that gets added using the Add method.
0
 

Author Comment

by:pwdells
ID: 37778397
I am using a recordset to populate the listbox and the Row Source Type is "Value List".  

Here is the code I use to populate, after the RS has been set.  (Company policy won't let me show the SQL in this instance. )

If rs_SS.RecordCount > 0 Then
    Me.lst0MAL_SS.AddItem ("MG; MAT NUM; MAT DESC; BAS MAT NUM; BAS MAT DESC; BATCHB; VS STAGE; BATCH; ABC; TSW; " & _
        "ORIGIN; HARVEST; PLO; PLANT; SLOC; TOTAL/KCS; TOTAL/MK; TRANS/KCS; TRANS/MK; WIP/KCS; WIP/MK")
    
    Me.lst0MAL_SS.ColumnHeads = True
    
    While Not (rs_SS.EOF)
        Me.lst0MAL_SS.AddItem (rs_SS.Fields(0) & "; " & _
            rs_SS.Fields(1) & "; " & _
            rs_SS.Fields(2) & "; " & _
            rs_SS.Fields(3) & "; " & _
            rs_SS.Fields(4) & "; " & _
            rs_SS.Fields(5) & "; " & _
            rs_SS.Fields(6) & "; " & _
            rs_SS.Fields(7) & "; " & _
            rs_SS.Fields(8) & "; " & _
            rs_SS.Fields(9) & "; " & _
            rs_SS.Fields(10) & "; " & _
            rs_SS.Fields(11) & "; " & _
            rs_SS.Fields(12) & "; " & _
            rs_SS.Fields(13) & "; " & _
            rs_SS.Fields(14) & "; " & _
            rs_SS.Fields(15) & "; " & _
            rs_SS.Fields(16) & "; " & _
            rs_SS.Fields(17) & "; " & _
            rs_SS.Fields(18) & "; " & _
            rs_SS.Fields(19) & "; " & _
            rs_SS.Fields(20) & "; ")
               
        rs_SS.MoveNext
    Wend

End If

Open in new window

0
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
LVL 10

Expert Comment

by:Anthony Berenguel
ID: 37778403
try removing the comma out of your TSW field with the replace function...

recordset.TSW = replace(recordset.TSW,",","")

Open in new window

0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 37778415
So, what is preventing you from changing the RowSourceType to "Table/Query", and setting the RowSource to the name of the query that is the source for your rs_SS recordset.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 37778422
try changing your computer regional setting to european..
0
 

Author Comment

by:pwdells
ID: 37778467
Is that the time zone setting?
0
 

Author Comment

by:pwdells
ID: 37778503
The reason why I am building the SQL in the VBA code is because the WHERE clause is built dynamically based on the fields that are selected and contain criteria.
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 37778506
No,

If you open your control panel, and select the Regional and Language Options, in the Formats tab there is a combo box where you can select an actual country (at least that is what it looks like in Vista).

But again, why are you not using the Table/Query RowSourceType instead of the ValueList?  This is so much simpler.
0
 
LVL 48

Accepted Solution

by:
Dale Fye earned 1000 total points
ID: 37778515
OK, but once you build the SQL string dynamically (which you had not told us previously), you just set the RowSource to the SQL string, like:

strSQL = "SELECT [field1], [Field2], ... from yourtable WHERE ..."

me.listboxName.Rowsource = strsql
0
 

Author Comment

by:pwdells
ID: 37778529
Ok - I will try that.

Sorry about withholding that information about the WHERE clause.  I was not sure if Value List vs. Table / Query was the issue.
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 1000 total points
ID: 37778530
what OS are you using?

for windows7

start > Control Panel

(note : select Small Icons in the View By: drop down)

then look for  > Region and Language
0
 

Author Comment

by:pwdells
ID: 37778535
I have my language settings set to Dutch now.  This should be interesting! :)  Well, it's only for 7 days.
0
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 37779353
After creating the recordset dynamically, perhaps you could save it to a temp table, and use that as the row source of the combo box (and use the Table/Query Rowsource type).
0
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 37779357
This would let you examine the table, and see if the fields are divided up correctly.
0
 

Author Closing Comment

by:pwdells
ID: 37779363
Thank you both for helping me out!
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

661 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