I'm creating a string of primary keys, called PKs, and then converting that string to an array, called A(). I'm using a comma as the delimiter.
The problem is that I'm getting a "Type Mismatch" error on the line: A = Split(PKs, ","). Here's the code:
I have this same code in other areas of the project and it works just fine. Can anybody see what I'm doing wrong?
The problem is that I'm getting a "Type Mismatch" error on the line: A = Split(PKs, ","). Here's the code:
Code:
Dim PKs As String
Dim ListItem as Variant
Dim A() As Long
PKs = "("
For Each ListItem In Me!ListBox.ItemsSelected: PKs = PKs & Me!ListBox.Column(0, ListItem) & ", ": Next ListItem
PKs = Left(PKs, Len(PKs) - 2) & ")"
A = Split(PKs, ",")
I have this same code in other areas of the project and it works just fine. Can anybody see what I'm doing wrong?