Running Visual Basic code in Access

R

Roseanne

Hi,

I've tried everything and cannot get my vb code to run in Access. For
testing purposes, I am trying to display a simple message in an OnClick
EventProcedure. Any ideas??

Thanks,
Roseanne
 
R

ruralguy via AccessMonster.com

What version of Access are you using on what OS? What cde have you tried?
 
B

Beetle

More info please.....

Can you post an example of the code?

What version of Access?

If A2007, is the source file in a trusted location?

_________

Sean Bailey
 
R

Roseanne

Thanks for the quick responses.

I am running Access 2007.

I am simply trying to close the form from a command button. I've even tried
displaying a simple message...MsgBox("Test").

The below code is being called from the OnClick event in the button...

Private Sub Test_Click()
On Error GoTo Test_Click_Err

DoCmd.Close , ""


Test_Click_Exit:
Exit Sub

Test_Click_Err:
MsgBox Error$
Resume Test_Click_Exit

End Sub
 
R

ruralguy via AccessMonster.com

Yep! Sounds like you need to set your trusted location.
http://www.btabdevelopment.com/main...owtoenablecodeandmacros/tabid/57/Default.aspx

Thanks for the quick responses.

I am running Access 2007.

I am simply trying to close the form from a command button. I've even tried
displaying a simple message...MsgBox("Test").

The below code is being called from the OnClick event in the button...

Private Sub Test_Click()
On Error GoTo Test_Click_Err

DoCmd.Close , ""

Test_Click_Exit:
Exit Sub

Test_Click_Err:
MsgBox Error$
Resume Test_Click_Exit

End Sub
More info please.....
[quoted text clipped - 16 lines]
 
Top