continuing lines of code vba-access

tofusunday

New member
Local time
Today, 15:15
Joined
May 4, 2010
Messages
2
I'm really new to having to do anything in visual basic. But, I have edited some code before that selects certain customers when a button is clicked on and then generates a report.

I don't know exactly how to continue code onto another line, as I reached my maximum length for the first line of customers. I thought I had it figured out, but I was getting a "run time error 7769 the filter would be too long error" after running it.

Here is an example of the code, how do I continue assigning customer names to the button click on another line of code, and is there a string length limit as far as how many customers I can assign to that button click?

Private Sub Command47_Click()
Me!Text2 = "='Cust1' or [CUS_CorpName]='Cust2' or [CUS_CorpName]='Cust3' or [CUS_CorpName]='Cust4' or [CUS_CorpName]='Cust5' "
strCriteria = "[SOD_RequiredDate] Between #" & Me![DTPicker8] & "# And #" & Me![DTPicker9] & "# And [CUS_CorpName]" & Me!Text2
' And [CUS_CorpName] = " & Me!Text2

Thank you in advance for your help!
 
Thanks for the reply.

I did what the article lists to combine lines together, it worked great for the first two lines. When I added the third and try to run it, I get:

Run time error 7769
Filter operation canceled. The filter would be too long.

Is there a length limit for something like this? There is a resulting text box that shows all the customer names that should be selected on a button click, but the error shows up before the report is generated.

Thanks!
 

Users who are viewing this thread

Back
Top Bottom