Build event

Mark-BES

Registered User.
Local time
Today, 06:53
Joined
Nov 23, 2004
Messages
85
On my form is a check box. I regularly use the navigation buttons to skip from record to record. When I skip to a record where this check box is ticked (value being -1) I wish the db to run a macro (to display a small message dialog box).

In design mode on the form, do I click "build event" and enter code?
If so, what code would I enter?

I have a very basic understanding of the type of thing to enter, however I just can't get my head around VB yet. any help would be much appreciated. Thanks.
 
You will use code in the form's Current event.

Code:
Private Sub Form_Current()
    Const MacroName As String = "YourMacro"
    If Me.MyCheckBox Then DoCmd.RunMacro MacroName
End Sub
 
;) Hello Mark!
Look at "DemoCheckMsgA97.mdb".
Yo don't need a macro.
 

Attachments

Thank you.

Hi there!

Easy when you know how! thank you so much.
 
if you macro is simply displaying a message box, you can even do it without using the macro

Code:
Private Sub Form_Current()
    If Me.MyCheckBox Then MsgBox "Message Goes Here"
    End If
End Sub
 
maxmangion said:
if you macro is simply displaying a message box, you can even do it without using the macro

Code:
Private Sub Form_Current()
    If Me.MyCheckBox Then MsgBox "Message Goes Here"
    End If
End Sub

You don't need the End If as you have not created an IF structure - just one If and Then.


Code:
Private Sub Form_Current()
    If Me.MyCheckBox Then MsgBox "Message Goes Here"
End Sub
 
check box

Hello,
can you please help me too...

I also have a check box.
I would need to display a subform whenever I check the box.

In my main form there are some personal details. if I check the box OwnVehicle (yes/no),I need the subform with vehicle properties to be shown. I have these two form related by one-to-many relationship.

waiting for your reply

thank you
 
check box

Hello,
can you please help me too...

I also have a check box.
I would need to display a subform whenever I check the box.

In my main form there are some personal details. if I check the box OwnVehicle (yes/no),I need the subform with vehicle properties to be shown. I have these two form related by one-to-many relationship.

waiting for your reply

thank you
 
Hm, it's my mistake, ti's for lendinas
not for maxmangion.
 
thnx Mstef

thank you Mstef for the code provided,

it is very simple to understand but I still cannot figure out why does it not work with my forms.

I am sending you my sample db to have a look.

thank you in advance for your help

waiting for your reply
 

Attachments

thnx Mstef

thnk you very much,
really.

I was not putting this line
Me.PassNo.SetFocus
on main form Current

so it always gave me error

thanks
regards
 
hiding db

hello again,

In my application I have tried to create an exe for the program in order to go directly to the switch form. i have created a startup macro and hide everything from the window menu.
I am sending you again my application in order to help me retrieve my tables and the rest, because I cannot find them in the computer.

thank you again

best regards Lendina
 

Users who are viewing this thread

Back
Top Bottom