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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling one form from another form, use of CallByName.

Status
Not open for further replies.

weightinwildcat

Programmer
May 11, 2010
84
US
Iam trying to open one form from another form, using CallByName, and to call a user-defined subroutine in the form that is being opened. I have gotten different error messages depending on the exact coding I am testing. The most recent one is error 424, for Object Required. I have an object variable call frmName, and it seems to be initializing correctly when its value is set, in this case to Forms("ORDERS"). However, I still get this error.

One of the end users sometimes gets an error, number Error Number -2147417848, indicating that a MoveNext command failed. As far as I can determine, this traces to issues involving late binding vs early binding. This is why I am looking at CallByName. Any thoughts as to the kind of syntax I should use, or any other thoughts on the problem?

Thank you in advance.
 

Not sure if this is your issue...The sub or function you are calling needs to be Public not Private

 
Do you have a sample of the callby name statement? Is the code that you are going to run from the other form something that could be made generic enough that you could put into a code module rather than the vba of the form?
 
As far as I can determine, this traces to issues involving late binding vs early binding. This is why I am looking at CallByName.
That statement does not make sense to me. What does late binding have to do with the need to use call by name? Please provide any code. Call by name allows the end user to "modify" code at runtime, not sure that relates to late binding.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top