opening access form from excel

K

keyur

hi

i have an access form that's linked to an excel worksheet.
this worksheet has a macro which opens the access form.
but with the same macro i want to close the excel workbook
once the access file is opened. with this code the access
form remains open as long as excel file is open.

can anyone help me with what should i add to this? or is
this even possible?

thanks

this is only the last part of the code

ActiveWorkbook.Save


' Initialize string to database path.
Const strConPathToSamples = "G:\Maintenance\CMMS\"

strDB = strConPathToSamples & "Stock Cards-35.mdb"

' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")

' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strConPathToSamples

appAccess.Visible = True
appAccess.WindowState = ppWindowMaximized

' Open Orders form.
appAccess.DoCmd.OpenForm "Stock Cards"

ActiveWorkbook.Close
 
S

smalltalk_vb

Once you open an Access instance from Excel , it opens an
instance to Access. Once you close Excel, that instance
to Access will also close. Excel is known as the
Automation controller. try sendkeys, DDE, oe WSH (windows
scripting host).

good luck.
 
G

Guest

thanks, sorry i am not an expert in VBA so is there any
other quick around this.

thanks again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top