Question : Access macro vs modules

Hello, I'm trying to use Excel's VBA logic for Access and write a few programs that can be called from Excel. I created a sub called myFirst from a database Modules tab and now want to use the below procedure to call it from excel. I'm a little confused about why there are two things in Access - macros and modules. And do we use VBA for both?  


' in Excel........


Public Sub RunAccessMacro()
  Dim db_app As Access.Application
 
  Set db_app = New Access.Application
  db_app.OpenCurrentDatabase ("G:\MFS\IPA\Sergei\Access\db3.mdb")
  db_app.DoCmd.RunMacro myFirst '???????????????????????? Excel can't see this sub
  db_app.Quit
  Set db_app = Nothing
End Sub


in Access.........

Sub myFirst()


Dim strCsv As String

strCsv = "G:\MFS\IPA\Sergei\Access\cash_statement.csv"

    DoCmd.TransferText acImportDelim, "spec1", "Cash", strCsv, True, ""

End Sub

Answer : Access macro vs modules

what exactly you want while you are in excel?

the command you are trying to exceute from access is importing csv file from a location to Access.
that command line will only work if you are executing it from Access.

Random Solutions  
 
programming4us programming4us