A question on the control source

  • Thread starter Thread starter kfc2
  • Start date Start date
K

kfc2

Guest
Hi everyone,
I am a newbie on Access. I have some problem dealing with the control source box. Would you please give a newbie some help here? Thanks

I have been trying to put an IF statement inside the control source but it won't work.
Is it possible to put an If statement in the control source?
I have put a function in my control source and it works fine. My problem with it is when the forum is activated, it runs the function right away. Now, I would like to the put a "RUN" botton on the page and the function can only be ran after the "RUN" botton is being clicked.

What I have in the control source is the following:
=bWALCS_FormIsFound("P00V2",[ID],"12")

If it is impossible to have an IF statement in there, how I can make the check box to check the condition of my "RUN" botton before it runs the function?

Sorry for my bad English

Thanks a lot
 
If your question is simply can I use a conditional IF in the control source of a textbox, the answer is yes, but with a small modification. You use the IIF() function.

=IIF(condition, truepart,falsepart)

But in your particular case, the best place to execute code when a command button is pressed, is the On_Click event of the button itself.
So you might want to leave the control source blank in the design view, and include something like this in the On_Click.

me.textbox=bWALCS_FormIsFound("P00V2",[ID],"12")
 
kfc2,

In the OnClick event of the RUN button:

Me.YourControl = bWALCS_FormIsFound("P00V2",[ID],"12")

You could also put the same line in the Oncurrent event of
your form and do away with the button.

Wayne
 

Users who are viewing this thread

Back
Top Bottom