Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Split in access 97

Posted on 2005-03-01
Medium Priority
Last Modified: 2008-01-09
I have converted my access 2003 project to access 97.And the following code breaks

Me.RecordSource = "SELECT .... WHERE (((Titel.TitelID)=" & Split(puStrReportParams, "-")(0) & ") AND ..."

at the Split()

Sub or function not defined.

any ideas on how to make split work?
Question by:DaFou
LVL 46

Assisted Solution

tbsgadi earned 200 total points
ID: 13436921
The functions here by Roman Koch do the trick

Good Luck!

LVL 54

Assisted Solution

nico5038 earned 200 total points
ID: 13437059
Checkout this question:

Or use the Left() function like
WHERE (((Titel.TitelID)=" & Split(puStrReportParams, "-")(0) & ") AND ..."
as you need just the first part before the "-"

WHERE (((Titel.TitelID)=" & trim(Left(puStrReportParams, Instr(puStrReportParams,"-")-1)) & ") AND ..."

The trim is used to remove leading/trailing blanks from the string you get and Instr(puStrReportParams,"-") returns the position of the first "-" in the field.

Clear ?


Author Comment

ID: 13437754
Split in access 2003 return a variant type variable that in essence acts as an array.

I will need to split a string on a delimiter and cycle trough the array.

How can something like this be done in access 97?
LVL 44

Accepted Solution

Arthur_Wood earned 1600 total points
ID: 13438395
here is the source code for an Access 97 version of the Split function, that behaves just like the version that is built into Access 2000 and newer:

Place this code in a standard MODULE (not a Class Module):

Public Function Split(Source As String, Splitter As String) As Variant
    Dim strInput As String
    Dim iloc As Integer
    Dim iCount As Integer
    Dim tempArray() As String
    strInput = Source
    iloc = InStr(strInput, Splitter)
    Do While iloc > 0
        iCount = iCount + 1
        ReDim Preserve tempArray(iCount)
        tempArray(iCount) = Left$(strInput, iloc - 1)
        strInput = Mid$(strInput, iloc + Len(Splitter))
        iloc = InStr(strInput, Splitter)
    If Len(strInput) > 0 Then
        iCount = iCount + 1
        ReDim Preserve tempArray(iCount)
        tempArray(iCount) = strInput
    End If
    Split = tempArray
End Function

LVL 44

Expert Comment

ID: 13448373
glad to be of assistance.


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

I have had my own IT business for a very long time. I started mostly with hardware and after about a year started to notice a common theme. I had shelves with software boxes -- Peachtree, Quicken, Sage, Ouickbooks -- and yet most of my clients were…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

564 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