Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-Time Error 2465

Status
Not open for further replies.

JulieFB

Programmer
Sep 8, 2006
10
0
0
CA
Hi,

I have a main report(MonthlyAll) that includes 4 subreports in its Report Footer.

I want to apply the following condition to one of the subreport (MonthlyCompleteAll) :

If Reports![MonthlyAll]![MonthlyCompleteAll].Reports![txtCouncil] = False Then
Reports![MonthlyAll]![MonthlyCompleteAll].Reports![Label7].Visible = False
Reports![MonthlyAll]![MonthlyCompleteAll].Reports![Text19].Visible = False
Reports![MonthlyAll]![MonthlyCompleteAll].Reports![Text5].Visible = False
End If

I put this code in the Main Report's Report Footer On Print Event but I am getting a Run-Time Error 2465 - Can't find the field "MonthlyCompleteAll" refered to in your expression.

I can't figure out what I am doing wrong. Can anyone help me ??

Thanks a bunch !

Julie

 
I'm assuming MonthlyCompleteAll is the name of your subreport? Try this...

If Me.MonthlyCompleteAll.Controls("txtCouncil") = False Then
Me.MonthlyCompleteAll.Controls("Label7").Visible = False
Me.MonthlyCompleteAll.Controls("Text19").Visible = False
Me.MonthlyCompleteAll.Controls("Text5").Visible = False
End If
 
Hi rjoubert,

Yes, MonthlyCompleteAll is one of my subreports.

I inserted your code in the Main Report's Report Footer On Print Event but I am getting Compile Error: Method or data member not found.

Any other ideas ?

Thanks,

Julie
 
Can you verify that "MonthlyCompleteAll" is the name of the subform CONTROL on your main report?

Also, what is txtCouncil? Is that a textbox or checkbox?
 
txtCouncil is a textbox refering to a Yes/No field.

And yes, you are right. The name was wrong. I corrected it to MonthlyCompleteAll and am still getting the same compile error.

Am I putting the code in the right place ? Should it be on the Main report or in the subreport ?

Thanks again !

Julie


 
You can either change that txtCouncil field to a checkbox, or use the following...

If Me.MonthlyCompleteAll.Controls("txtCouncil").Value = "No" Then

You may want to put the code in the Format event of the Report Footer.
 
I changed txtCouncil to a Yes/No instead of a True/False.

I entered your code in the On Format Event of the Report Footer of the Main report. Here is the code:

If Me.MonthlyCompleteAll.Controls("txtCouncil").Value = "No" Then
Me.MonthlyCompleteAll.Controls("Label7").Visible = False
Me.MonthlyCompleteAll.Controls("Text19").Visible = False
Me.MonthlyCompleteAll.Controls("Text5").Visible = False
End If

And am getting: Run-Time Error 2467: The expression you entered refers to an object that is closed or doesn't exist.
 
We need to find the root of the problem here. Let's try this...

1. Comment out all three lines inside of the If block, and add a simple line to throw up a Msgbox. If it works without error, we know the first line (If Me.MonthlyCompleteAll.Controls("txtCouncil").Value="No" Then) is ok.

2. Remove the Msgbox line and just uncomment the 2nd line of code (the "Label7" line). If this works without error, we know that line is ok.

3. Uncomment the 3rd line ("Text19"). If it works without error, that line is ok.
 
I comment out the 3 lines and put a message box but it doesnt go further then the 1st line. Same error.

This is so frustrating !
 
I changed txtCouncil to a Yes/No instead of a True/False.

Do you mean you changed the field in the underlying table to Yes/No? Comment out all of the code...what shows up in the txtCouncil textbox?
 
Hi again, I finally got it to work. I was making this too complicated I guess.

I put the following code in the On Format Event of my MonthlyCompleteAll subreport:

If Me.txtCouncil = False Then
Me.Text5.Visible = False
Me.Text19.Visible = False
Me.Label7.Visible = False
End If

Thanks so much for spending so much time with me on this. This forum is great !

Have a great day !

Julie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top