Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute Module from Macro : Access 2003

Status
Not open for further replies.

DajTwo

Technical User
Jul 17, 2008
157
US
I have read the help file and several other forums on how to run a Access 2003 VBA code from an Access 2003 Macro, but nothing works.

The VBA code works very well by itself when I execute it.

When I try to create a macro, then either "open a module", or "run code" macro comamnds, the code does not execute.

Access opens the modeule in design view and waits for me to execute it (press execute)

Pls help

Option Compare Database
Option Explicit

'------------------------------------------------------------
' Connex
'
'------------------------------------------------------------
Public Function Connex()
On Error GoTo Connex_Err

DoCmd.SetWarnings False
DoCmd.OpenQuery "300-NON NOT CONNEX ASSET STATUS 81", acViewNormal, acEdit
DoCmd.OpenQuery "301-NON NOT CONNEX ASSET DATA", acViewNormal, acEdit
DoCmd.OpenQuery "302-NON NOT CONNEX SUMMARY", acViewNormal, acEdit
DoCmd.OpenQuery "303-NON NOT CONNEX ASSET DATA ARREARS", acViewNormal, acEdit
DoCmd.OpenQuery "307-NON NOT CONNEX ASSET DATA PORTFOLIO", acViewNormal, acEdit
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "301-NON NOT CONNEX ASSET DETAILS", "C:\Connex.xls", True, ""
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "302-NON NOT CONNEX SUMMARY2", "C:\Connex.xls", True, ""
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "308-NON NOT CONNEX PORTFOLIO SUMMARY", "C:\Connex.xls", True, ""
DoCmd.SetWarnings True

Connex_Exit:
Exit Function

Connex_Err:
MsgBox Error$
Resume Connex_Exit

End Function

 
Found the error, thanks

Well the error found me..

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top