[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

MS Access Open another database from current and close Current

Posted on 2016-09-30
5
Medium Priority
?
46 Views
Last Modified: 2016-09-30
I have two databased files.  CurrentDb and HistoryDB  in MS Access 2003.
From a form in HistoryDB on  command button click event I need next:
 I want to open two bound forms in CurrentDB with particular record in
then I want to close HistoryDB and have CurrentDB form frmMainEdit stay  opened and frmMainOutstand should be hidden.
I started with some code as bellow but can not figure out how to close HistoryDB at the end of procedure and have CurrentDB open.
   
********************************************

Private Sub CmdOpen_Form_In_CurrentDatabase_Click()


Dim strDB As String
strDB = "D:\Databases\CurrentdB.mdb"
   
Dim appAccess As Access.Application
Set appAccess = New Access.Application

Dim strFilter1 as string
strFilter1 = "Some text xxxxxx"


appAccess.OpenCurrentDatabase strDB
appAccess.Visible = True

appAccess.UserControl = True





stDocName = "frmMainOutStand"
appAccess.DoCmd.OpenForm stDocName

Forms!frmMainOutstand!sfrmMainOutStandCurr.Form.Filter = strFilter1
Forms!frmMainOutstand!sfrmMainOutStandCurr.Form.FilterOn = True


Forms!frmMainOutstand!sfrmMainOutStandHis.Form.Filter = strFilter1
Forms!frmMainOutstand!sfrmMainOutStandHis.Form.FilterOn = True






stDocName = "frmMainEdit"
appAccess.DoCmd.OpenForm stDocName

Forms!frmMainEdit.Form.Filter = strFilter1
Forms!frmMainEdit.Form.FilterOn = True

End Sub
0
Comment
Question by:Taras
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
COACHMAN99 earned 2000 total points
ID: 41823770
Did you try docmd.quit after all your other code
0
 

Author Comment

by:Taras
ID: 41823930
Path It works but:

I got this part working
stDocName = "frmMainEdit"
appAccess.DoCmd.OpenForm stDocName

Forms!frmMainEdit.Form.Filter = strFilter1
Forms!frmMainEdit.Form.FilterOn = True
And I can see at bottom of form is saying: Filtered


It works but I can not get this part to work:

stDocName = "frmMainOutStand"
appAccess.DoCmd.OpenForm stDocName

Forms!frmMainOutstand!sfrmMainOutStandCurr.Form.Filter = strFilter1
Forms!frmMainOutstand!sfrmMainOutStandCurr.Form.FilterOn = True


Forms!frmMainOutstand!sfrmMainOutStandHis.Form.Filter = strFilter1
Forms!frmMainOutstand!sfrmMainOutStandHis.Form.FilterOn = True

And I can see at bottom of form is saying Unfiltered ???
0
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 41824130
DID DOCMD.QUIT WORK?
0
 

Author Comment

by:Taras
ID: 41824141
Yes ,  but now filter on one  form is working but not working on those two sub forms.  
Should I post separate question for that?
0
 

Author Closing Comment

by:Taras
ID: 41824212
Thank you
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question