VBA String variable

toleafs

Active Member
Joined
Jun 27, 2005
Messages
498
Hello
Any help is appreciated. I am using the following code to group the ru****s in an query. In the query I have the following field in the query: ReportID: joinReportIDGL([BDDDataElement]). The issue is that the field is cutting off at 255 characters. Is there a way to modify the code to capture more characters>
thanks in advance for your help.

Public Function joinReportIDGL(LN As String) As String
' Groups ReportID in BDDFeed
Dim rs As Recordset
Dim ret As String

Set rs = CurrentDb.OpenRecordset("Select Distinct [Report ID] from tblReportsToCognos where BDDDataElement = """ & LN & """")

rs.MoveFirst
Do While Not rs.EOF
ret = ret & rs![Report ID] & ","
rs.MoveNext
Loop

If rs.recordCount = 0 Then
rs.Close
joinReportIDGL = ""
Else
rs.Close
ret = Left(ret, Len(ret) - 1)
joinReportIDGL = ret
End If
End Function
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Not sure. Sometimes the data is there but not visible. String variables are not limited to 255 characters but sometimes Access behaves funny with that kind of data. Occasionally its just the column width!
 
Upvote 0
I tried 3308 symbols - no problem in a select query.

If the query is trying to write to a table - then probably the issue is the length of field (limited to 255).
 
Upvote 0

Forum statistics

Threads
1,214,515
Messages
6,119,973
Members
448,933
Latest member
Bluedbw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top