Ali Edwards
Registered User.
- Local time
- Today, 19:48
- Joined
- Apr 19, 2001
- Messages
- 68
Hi and please help as I'm very lost!!
I have a form [Main form], and subform [P1].
In the subform's Current and After Update events there is code: Call tablevisibility, which is a module containing the code:
Public Function TableVisibilty
dim tablevis As Variant
if not isnull ([Forms]![Main form]![P1]![Port 17 loss]) then
tablevis = 5
if not isnull ([Forms]![Main form]![P1]![Port 18 loss]) then
tablevis = 4
end if
end if
etc etc
if tablevis = 5 then
Forms![Main Form]![P1]![16 Port Reveal].Visible = false
f tablevis = 4 then
Forms![Main Form]![P1]![16 Port Reveal].Visible = true
end if
end if
etc etc
End Function
There is a lot more to the code but this will do in order for me to explain!
There is a delete button on the Main Form, which obviously deletes the record in the main form and all the records related to that record in the subform [P1].
The problem I have is that when I press the delete button I get the message:
Run Time error 2455
You entered an expression that has an invalid reference to the property form/report.
if I click Debug, the highlighted code is the first line of my module (as above) :-
if not isnull ([Forms]![Main form]![P1]![Port 17 loss] then
tablevis = 5.
Otherwise the procedure works OK, it's only when I delete a record from the main form.
I have tried setting warnings to false in both the delete button event and the module itself but that hasn't worked. Also I attempted error trapping but have limited knowledge on that!
Or is it possible to stop calling the TableVisibility module (which is called from the subform) when the delete button in the Main form is pressed, and resume after the record has been deleted??
Really grateful for any ideas!!

I have a form [Main form], and subform [P1].
In the subform's Current and After Update events there is code: Call tablevisibility, which is a module containing the code:
Public Function TableVisibilty
dim tablevis As Variant
if not isnull ([Forms]![Main form]![P1]![Port 17 loss]) then
tablevis = 5
if not isnull ([Forms]![Main form]![P1]![Port 18 loss]) then
tablevis = 4
end if
end if
etc etc
if tablevis = 5 then
Forms![Main Form]![P1]![16 Port Reveal].Visible = false
f tablevis = 4 then
Forms![Main Form]![P1]![16 Port Reveal].Visible = true
end if
end if
etc etc
End Function
There is a lot more to the code but this will do in order for me to explain!
There is a delete button on the Main Form, which obviously deletes the record in the main form and all the records related to that record in the subform [P1].
The problem I have is that when I press the delete button I get the message:
Run Time error 2455
You entered an expression that has an invalid reference to the property form/report.
if I click Debug, the highlighted code is the first line of my module (as above) :-
if not isnull ([Forms]![Main form]![P1]![Port 17 loss] then
tablevis = 5.
Otherwise the procedure works OK, it's only when I delete a record from the main form.
I have tried setting warnings to false in both the delete button event and the module itself but that hasn't worked. Also I attempted error trapping but have limited knowledge on that!
Or is it possible to stop calling the TableVisibility module (which is called from the subform) when the delete button in the Main form is pressed, and resume after the record has been deleted??
Really grateful for any ideas!!
