Calling Form Function from another form

  • Thread starter Thread starter Brian
  • Start date Start date
B

Brian

Here is the problem I am trying to solve.

I have a 'Customer Page' with several command buttons on
it. When the form opens my Current() function checks
several items to determine what buttons to activate and
which to deactivate. This part works exactly as designed.

From this page, a user can click the 'Order' button and
handle any processing there. When this form is closed I
am trying to run the 'Customer Page' Current() function
again to continue to ensure that only the correct command
buttons are available (this is because a certain order can
change different items). This is where the problem is.

I have made the Current() function public and have tried a
number of different methods to call/activate it, without
success. The closest I have gotten is when I had Order
form Requery the Customer form. This worked partially but
takes the user back to the first record (not good if they
are working in the middle or end of a couple hundred
records.

What I need is the proper syntax for the call function,
I've been using ("Call Forms.[FSE Customer
Maintenance].Form_Current"), or another method that will
accomplish the same task.

Thanks for the help.
 
Brian said:
I have a 'Customer Page' with several command buttons on
it. When the form opens my Current() function checks
several items to determine what buttons to activate and
which to deactivate. This part works exactly as designed.

From this page, a user can click the 'Order' button and
handle any processing there. When this form is closed I
am trying to run the 'Customer Page' Current() function
again to continue to ensure that only the correct command
buttons are available (this is because a certain order can
change different items). This is where the problem is.

I have made the Current() function public and have tried a
number of different methods to call/activate it, without
success. The closest I have gotten is when I had Order
form Requery the Customer form. This worked partially but
takes the user back to the first record (not good if they
are working in the middle or end of a couple hundred
records.

What I need is the proper syntax for the call function,
I've been using ("Call Forms.[FSE Customer
Maintenance].Form_Current"), or another method that will
accomplish the same task.

Either

Forms![FSE Customer Maintenance].Form_Current
or
Call Forms![FSE Customer Maintenance].Form_Current()

should work.
 
Brian said:
Thanks for the reply Marshall:

I had tried both of these before, but tried again.
Unfortunately, I'm still getting errors. I thought I
would see if you had any insights on these.

When using the 'Call Forms![FSE Customer
Maintenance].Form_Current()' I get:
'Compile Error: Expected . or (' and the pointer goes to
the !

Sorry Brian, I forgot that the Call syntax won't work with a
form reference. You'll have to use the simpler syntax:

Forms![FSE Customer Maintenance].Form_Current

Note the omission of the parenthesis.
--
Marsh
MVP [MS Access]


-----Original Message-----
Brian said:
I have a 'Customer Page' with several command buttons on
it. When the form opens my Current() function checks
several items to determine what buttons to activate and
which to deactivate. This part works exactly as designed.

From this page, a user can click the 'Order' button and
handle any processing there. When this form is closed I
am trying to run the 'Customer Page' Current() function
again to continue to ensure that only the correct command
buttons are available (this is because a certain order can
change different items). This is where the problem is.

I have made the Current() function public and have tried a
number of different methods to call/activate it, without
success. The closest I have gotten is when I had Order
form Requery the Customer form. This worked partially but
takes the user back to the first record (not good if they
are working in the middle or end of a couple hundred
records.

What I need is the proper syntax for the call function,
I've been using ("Call Forms.[FSE Customer
Maintenance].Form_Current"), or another method that will
accomplish the same task.

Either

Forms![FSE Customer Maintenance].Form_Current
or
Call Forms![FSE Customer Maintenance].Form_Current ()

should work.
 
Back
Top