Forms should load on entering values

pillaisg

New member
Local time
Today, 08:10
Joined
Dec 13, 2007
Messages
8
Hi!,
I am trying to make something to make my job easier. To be honest I am a beginer in this field. I am having a field, when I enter one value ( let that be 10) it should pop up one form and if another value ( let that value be 20) it should pop up another form.
or else I can explain in this way
If data field value = 10 then it should run macro 1
& if data field value = 20 then it should run macro 2

thanks
Pillai
 
Pillai

If you go to the macro in Design you will see View on the toolbar. Click on View and you want Conditions....then another column will appear on the left next to the Action column.

In this column you enter your condition, which if true means the action will run. If we call your main form MainForm then your conditions will be

[Forms]![MainForm]![FieldName] =10
[Forms]![MainForm]![FieldName] =20

You can make another macro and in that new macro you have RunMacro as your actions and you select Macro1 and Macro2. The condition lines will determine which macro runs and hence which seconday form opens.

Alternatively you can have one macro and the two actions are OpenForm and you select (at the bottom of the macro design page) the two secondary forms and enter the conditions as above.

If you go to your main form in design mode and click on the field in question with the right clicker and select properties and Event you will see a lot of circumstances where by a macro or Visual Basic will run. For example you might attach your macro to OnLostFocus. In that case the macro will run if you have clicked in the field (to type your number) and then you click in another field. You will see there is an almost endless list. You could also attach your macro to the Event for a label or a button.

If you right click on the area of the Form Design page that is below or off to one side of the form itself and then Properties and Event that will list all the events that will trigger a macro by the form itself. For example, a macro could be triggered when the form opens or when the form is closed plus a heap of other events.
 

Users who are viewing this thread

Back
Top Bottom