Opening VBA Editor from a Command Button

commandolomo

Registered User.
Local time
Today, 19:41
Joined
Jun 11, 2004
Messages
73
Hey

Does anyone if it is possible / how to open the "Code" (VBA Editor) screens for modules and forms from a command button? Instead of going through Form>Design>(Code Icon), I want to be able to access the code from a command button.

Does anyone know the code to trigger the vba editor to open?

Cheers

PJL
 
Code:
Private Sub Knop0_Click()
  DoCmd.OpenModule "Form_Form2"
End Sub
 
You can hit the code button after highlighting a form in the db window.

See the attached screenshot. Does this help?

kh
 

Attachments

  • Image2.gif
    Image2.gif
    7.7 KB · Views: 263
Cheers chaps

Bert - I will try the vb code, many thanks

kh - Thanks for this, but I have diabled all menus and command bars, and for an easy way for me view the modules, without having to re-enter the db using the shift bypass, I wanted to launch vb from a cmb button.

PJL
 
Code:
Private Sub btnTestCode_Click()
On Error GoTo btnTestCode_Click_Err
 
    DoCmd.RunCommand acCmdVisualBasicEditor
 
btnTestCode_Click_Exit:
    Exit Sub
 
btnTestCode_Click_Err:
    MsgBox "Private Sub: btnTestCode_Click" & Chr$(13) & _
    "Error number: " & Err.Number & Chr$(13) & _
    Err.Description, vbOKOnly, "frmTestCode"
    Resume btnTestCode_Click_Exit
    
End Sub
 
Last edited:

Users who are viewing this thread

Back
Top Bottom