Runtime error 2467 when report runs (1 Viewer)

Rik_StHelens

Registered User.
Local time
Today, 20:42
Joined
Sep 15, 2009
Messages
164
Hi

I have a report which creates overdue payment notices for any accounts with outstanding balances over 60 days old.

Every time i run the report it gives me the error code 2467 ("The expression you entered refers to an object that is closed or doesn't exist")

When i run debug it shows me the following VB code:

Private Sub ViewReports_Click()
Dim X As Variant
For Each X In ReportList.ItemsSelected
DoCmd.OpenReport ReportList.ItemData(X), acViewPreview
Next
End Sub



And the debugger highlights "Next"


I'm not really VB literate at all so this doesn't mean much to me. I did do some digging around and found a lot of people who had this problem were using subreports, but I am not using any sub reports



Thanks for your time.
 

ajetrumpet

Banned
Local time
Today, 14:42
Joined
Jun 22, 2007
Messages
5,638
try using "NEXT X" instead ofjust NEXT.

also, try searching for Lister's multi select list box code in the code repository here. i would say that would be a better way to find out what's selected in your box instead of using what you are now.
 

SOS

Registered Lunatic
Local time
Today, 12:42
Joined
Aug 27, 2008
Messages
3,517
Are you sure it is the code here causing the problem? Can you open the report manually? If so, what is the list box's bound column? Are you sure it is text?
 

vbaInet

AWF VIP
Local time
Today, 20:42
Joined
Jan 22, 2010
Messages
26,374
I'm not sure why you're continously opening the same report based on the items selected. You could build up an sql string and pass it to the report so it opens once with all the relevant reports? Or you have your reasons?
 

Rik_StHelens

Registered User.
Local time
Today, 20:42
Joined
Sep 15, 2009
Messages
164
The report is used in 2 ways,

1. To create credit stop warnings for ALL customers when run once (Using a "Like * & [MyString] & *" to pass in a value). This is done at the end of every month, and i use grouping to create seperate reports in one run

2. To create a credit stop warning for one specific customer at any time, searched by their customer code....



Another development.... one of the guys in our company has a copy which runs no problem, but everyone elses has this error

confusing..
 

Rich

Registered User.
Local time
Today, 20:42
Joined
Aug 26, 2008
Messages
2,898
Try searching here for Missing/Broken Reference
 

Users who are viewing this thread

Top Bottom