views:

538

answers:

2

I have a textbox on a MS Access form that users are going to copy a column of numbers into from an excel spreadsheet. I need to take this input and use it as parameters to build a query. I have code that looks like this

Dim data as variant
Dim input as String
data = Split(input,vbLf)

I want to be able to build a list of the input from the users but I can't figure out how to split it on the line break. I've tried "\n\r", "\n". "\r", vbCrLf, vbLf. The input looks like "12345[][]23456" with the box characters between each number

Thanks

+4  A: 

I got Split to work for me using vbCrLf. I also wrote the result of Split to a String array.

Here's my code:

Dim data() As String
Dim yourInput As String
data = Split(yourInput, vbCrLf)
Jay Riggs
I tested this out as well with a variant and it worked fine using vbCrLf.
Buggabill
thanks for the answer. I appreciate the help
jim
+3  A: 

vbCRLF worked for me, try: Strings.Chr(13) & Strings.Chr(10) (which is vbCRLF)

try to see what is the ASCII code of those 2 boxes:

    //ex for input = "12345[][]23456"
    Strings.Asc(Strings.Mid(input, 6, 1)) 
    Strings.Asc(Strings.Mid(input, 7, 1))
najmeddine