Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2008

Tip: Looking for answers? Try searching our database.

Form Close ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michelle - 18 Mar 2008 15:01 GMT
I have a form "frmLocation" the form has a list box so the user can select
the location to run a query "qurEquipLocation"  that is used to produce a
report "rptEquipLocation"
I have it set up so frmLocation opens you select the location and then click
OK when you click OK it opens frmEquipLocation in print preview...this all
works great.
Now what I would like to happen is once the report is open it closes the
frmLocation.
Here is the code I have and it does not do what I want.

I have tried this code on the OK  button....

Private Sub cmdOK_Click()
   DoCmd.OpenReport "rptEquipLocation", acViewPreview, "qurEquipLocation"
   DoCmd.Close acFrom, "frmLocation"
End Sub

And I have have tried this code in the report in the On Open Event

Private Sub Report_Open(Cancel As Integer)
DoCmd.Close acFrom, "frmLocation", acSaveNo
End Sub

I am sure I am just missing one little thing...also if it makes any
difference frmLocation is a popup
Paolo - 18 Mar 2008 15:55 GMT
Hi Michelle,
If the code you posted is a verbatim copy of the code you tried to execute
you're missing nothing, 'cause is just a typo:
to identify a form in the close method it's not acFrom but acForm

HTH Paolo

> I have a form "frmLocation" the form has a list box so the user can select
> the location to run a query "qurEquipLocation"  that is used to produce a
[quoted text clipped - 21 lines]
> I am sure I am just missing one little thing...also if it makes any
> difference frmLocation is a popup
Allen Browne - 18 Mar 2008 15:59 GMT
You have used acfROm instead of acfORm in both cases.
Presumably you are squashing errors, or Access would be reporting a problem
here.

It might be better to use the Close event of the report if the report's
query actually tries to do something with the form.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I have a form "frmLocation" the form has a list box so the user can select
> the location to run a query "qurEquipLocation"  that is used to produce a
[quoted text clipped - 22 lines]
> I am sure I am just missing one little thing...also if it makes any
> difference frmLocation is a popup
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.