To run access module in VBasic

To run access module in VBasic

Post by Mehmet ALKA » Sat, 01 Mar 2003 15:37:11



Hello,

If it is possible to run in VBasic for Access module.

What can I do?

Mehmet ALKAN

 
 
 

To run access module in VBasic

Post by Paul Clemen » Sat, 01 Mar 2003 22:15:59


Hello,

If it is possible to run in VBasic for Access module.

What can I do?

See the following MS KB article:

ACC97: How to Run Macros in Other Office Programs
http://support.microsoft.com/default.aspx?scid=kb;EN-US;177760


Microsoft MVP (Visual Basic)

 
 
 

1. Running MS Access Module from VB

Hi,

I am trying to make a VB program to communicate via Automation with an
Access Module, but I am getting the errors I am indicatin to you.

The DoCmd. method called from VB(5) does not support the DoCmd.Run(Code)
method. How could you solve this kind of prob?

I have a

Any help would be appreciated

Thank you
Camilo
-------------------------------------------------------------------------
'Access Module
Option Compare Database
Option Explicit

Function Module1(sByAccess As String)

 On Error GoTo Module1_Err
 MsgBox " Here by Access now" & sByAccess

Module1_Exit:
    Exit Function
Module1_Err:
    MsgBox Error$
    Resume Module1_Exit

End Function

-------------------------------------------------------------------------
'VB5 code
Private Sub RunModule_Click()
 Dim objAccessApp As Object
 Dim sDBName As String
 Dim sAcMdlName As String

 On Error GoTo AutmtnError

 sAcMdlName = "Module1"
 sDBName = "E:\PRJCTS\AccessApp\DBModule.mdb"
 Dim AcMdl As Access.Module

 Set objAccessApp = CreateObject("Access.Application")
 With objAccessApp
  .OpenCurrentDatabase FilePath:=sDBName
MsgBox " Data base should be opened" & sDBName
  .DoCmd.OpenModule sAcMdlName
  Set AcMdl = .Modules(sAcMdlName)
MsgBox " Module " & AcMdl.Name & " should be open"

''''''' This is what it does not work '''''''''

'  AcMdl.Application.Run sAcMdlName, " Hi from VB"
'  AcMdl.Application.Run sAcMdlName   '<- tried this one also with Mudule
without args


' ... MS Access Number: 2517

'''''''''''''''''''''''''''''''''''''''''

MsgBox " Module about to be closed"

  .DoCmd.Close acModule, AcMdl.Name, acSaveNo

MsgBox " Data base about to be closed"

  .CloseCurrentDatabase
 End With

 DoEvents
 Set objAccessApp = Nothing

 Unload Me
 Exit Sub
AutmtnError:
 MsgBox Err.Description & " from " & Err.Source & " Number: " &
CStr(Err.Number)

End Sub

2. FM Pro 5.5 Username on Web

3. run access module from excel sub

4. DB applications: VBasic and Delphi

5. Running an Access module from VB

6. DBO Certificate any good?

7. How to run an Access module?

8. calling/running MS Access module from ASP pages

9. ACCESS run-time module

10. Help for Database password in Access and VBasic

11. Date comperasion problem Vbasic-Access 2000

12. access 2 vbasic GUI maskedit