Solved Error 94 Invalid use of Null when calling a Sub in a subform (1 Viewer)

HalloweenWeed

Member
Local time
Today, 10:43
Joined
Apr 8, 2020
Messages
102
Hi again,
I have been having some trouble with improving my 'live search' form, where it shows results as you type search criteria. Because the "requery" function interferes with the cursor in the criteria input textbox control, and I have to transfer the .Text contents into another control for the actual search parameters on every keystroke, I am trying breaking it into form and subform (for the results). The criteria search is too complex for an SQL, so I am doing the results in vba code, saving them in a table for the subform. I have a subroutine in the subform module that does the actual table-making, and am trying to call it from the parent form with the code:
Code:
Call Me.Form.[GrvntSrchSeqNoSubfrm].Form.GrvtSrch
I have declared the subroutine "Public." I know it works, it was working before I split the form into form/subform. But at run-time I get "Error 94: Invalid use of Null." Why?

There are no parameters to pass, to or from the subroutine.
 

HalloweenWeed

Member
Local time
Today, 10:43
Joined
Apr 8, 2020
Messages
102
I just found a reference in the subform subroutine to a textbox control on the parent form, and corrected it, adding the prefix: "Me.Parent!". But now I get Error 91: Object variable or With block variable not set. The subroutine does have a (single) sizable with block.

What is tripping me up, is the VBA editor is debugging on the parent form line that does the call, and not the subroutine itself. Any ideas/tips?
 

Isaac

Lifelong Learner
Local time
Today, 07:43
Joined
Mar 14, 2017
Messages
2,643
Are you sure the code debugs and breaks on that exact line you posted? I'd guess it breaks on some other line....probably one inside that procedure mentioned.
 

Isaac

Lifelong Learner
Local time
Today, 07:43
Joined
Mar 14, 2017
Messages
2,643
are you able to debug>compile?
 

Isaac

Lifelong Learner
Local time
Today, 07:43
Joined
Mar 14, 2017
Messages
2,643
Can you post
GrvtSrch
code?
 

HalloweenWeed

Member
Local time
Today, 10:43
Joined
Apr 8, 2020
Messages
102
OK I figured it out. I set a breakpoint on said "call" line, and followed the execution. I found a recordset name that was similar but not the one I was using, it was erring on rst.close in the subroutine. Fixed the recordset name and I think I have it solved. Thank you for your effort Isaac.
 

Isaac

Lifelong Learner
Local time
Today, 07:43
Joined
Mar 14, 2017
Messages
2,643
Interesting. I wonder if that was the cause - but glad you got it working!
 

Users who are viewing this thread

Top Bottom