Forms :: Closing Form With Subform

Jul 8, 2014

I have a form with a subform. There is a close button on the main form which I have applied a key command of Alt + c and when the focus is on the main form it closes the form as you expect. But if the focus is on the subform, using Alt+c does nothing. I am trying to give the user a way to avoid using the mouse (so they do not have to click on the button from the subform. Also it is confusing that the key command doesn't always work in the view of the user, and in reality he is on the subform.)

So my thinking is:

1. Can I create a close button on the subform (and give it the key command of Alt + c) and in the code close the form and subform, if so - how to I refer to the form/subform?

2. Is there some way to apply the key command of Alt + c on the subform to activate the close button on the main form?

View Replies


ADVERTISEMENT

Forms :: Go To New Record On Subform After Closing Pop Up Form

Jul 9, 2013

I have a form (frmAuditEntry) that includes a subform (sfrmAuditDetail). The user will enter audit information on the subform. There is a check box on the subform to identify containers that had errors in selection. When the box is check by the user, a pop up form opens where the user can enter the details regarding the type of error. The audit number and the container ID are carried over from the main form to the pop up form to link the information.

This is the code I have in the AfterUpdate event of the checkbox:

Private Sub Errors_AfterUpdate()
Dim rs As Object
Dim strBookmark As String
strBookmark = Me.ContainerID
Me.Requery

[Code] ....

This works great and keeps the focus on the record the user checked having errors so the right information transfers tot he pop up form fields. When the pop up form is closed, the focus goes back to the subform but keeps the focus on the container ID control of the record that the user previously checked as having errors (hope that makes sense).

What I would like to happen is this: When the pop up form is closed, I want the focus to go back to the subform but to go to the last blank record on the subform (if the user moved off the record before checking the error checkbox) or go to a new record (if the user did not move to a new record already before checking the error checkbox).

View 1 Replies View Related

Forms :: Refresh Subform On One Form While Closing Another?

Apr 14, 2014

I have two ways to enter work placements for students, I need to refresh a subform on one form while closing another.

The issue here is the form with the subform may not be open as mentioned above.

So is it possible on closing one form to refresh a subform only if it's parent form is currently open?

View 1 Replies View Related

Forms :: Subform - Input Box Reappears When Closing Database

Nov 13, 2014

I have a

- form called "Hauptformular" and a
- subform called "qry_tracking_Unterformular". Then there is a
- button called "cb_filialname".

Now when opening the Database, the form appears with the subform containing the
- query "qry_tracking"

When hitting the button "cb_filialname" the subform receives the contents of the
- query "qry_tracking_FilName", that has a filtering option on the Column "Filiale": "Like [Filialname?]"

Now the filtering works fine with the following Code:

PHP Code:

Private Sub cb_filialname_Click()Me!qry_Tracking_Unterformular.Form.FilterOn = 
FalseMe!qry_Tracking_Unterformular.Form.RecordSource = "qry_tracking_FilName"End Sub 

-> when you hit the button, the inputbox

Filialname?

appears.

The problem now is, that after having used the button, when I click the "Exit" cross right up there, the inputbox appears again.

View 2 Replies View Related

Forms :: Closing A Query From A Form

Dec 24, 2014

I have created a form with buttons which runs queries. The parameters I need for the query are being passed through just as I wish and the relevant query is run correctly. However, if I then press the button on the form with different parameters I get the results from the previous query. I can only solve this by closing the query before pressing the button. Is there an easy way to close the query to prevent this from happening. In case this is relevant, the only data which I am returning from the query is stored in the windows clipboard.

View 6 Replies View Related

Forms :: Access 2010 - Opening New Form And Closing Current Form?

Mar 14, 2013

I am using Access 2010 - Version 14.0.61.29.5000 (32-bit)

I am building a custom Export Wizard to export data to Excel using the Report Wizard for the basic ideas.

All I am trying to do is have a [Back] button on a form to open another form and close the current form.

Private Sub cmdBack_Click()
DoCmd.OpenForm "frm_ExportWizardPage2", , , , , , Nz(Me.OpenArgs)
DoCmd.Close acForm, "frm_ExportWizardPage3"
End Sub

The new form is opening but then the current form is not closing. All forms are the same size, shape and positioned centrally although this should not make any difference.

Could this be anything to do with which form has the focus when I open the new form?

View 2 Replies View Related

Forms :: How To Use Data On A Form When Running Code Before Closing The Form

Feb 4, 2014

I have a bound form with a few fields. I would like to run a sub after some of these fields are modified, but not others. I would like it to run only once, after user finishes his work on the form.

When using the Unload event - the form on the form is not there anymore (or did I get something wrong?).

Is there a way to trap Data on form just before the form closes?

View 4 Replies View Related

Forms :: OnLoad Runs When Closing Form

Oct 9, 2013

I have an A2007 application running on XP. From main form, Form1, another form, Form2, is opened.

When I attempt to close the application by clicking in the cross in the rh-corner of Access window, I get a crash midway through the OnLoad of Form2. I cannot figure out why the heck the On Load event fires when the form is being closed, and have some difficulties stepping through the code.

I recall having heard of OnLoad firing when trying to close a Form.

View 6 Replies View Related

Forms :: Saving A Record And Closing A Popup Form

Jun 15, 2014

I have a popup called by a subform to add a new record or edit a selected record. I keep getting "Runtime error 32502". The value you entered isn't valid for the field "|"

I have no required fields and all the drop down related fields have the right value type in them (That I can find)The only "|" reference I can find is in the OpenArgs content below when I load the form. If I'm adding a new record I pass two fileds via the OpenArgs

Private Sub Command52_Click()
DoCmd.OpenForm "AddDebtorPaymentFrm", , , , acFormAdd, OpenArgs:=Me![DebtorId] & "|" & Me![MatterId]
End Sub

or if I'm modifying a record from the subform on click I

Private Sub Text38_Click()
DoCmd.OpenForm "AddDebtorPaymentFrm", acNormal, , "[Transactions].[TransId] = " & Me.TransId, acFormEdit
End Sub

Below is the Popup Load code

Private Sub Form_Load()
If Me.DataEntry = True Then
Me.VariableHeading = "Add A Debtor Payment"

[code]....

View 8 Replies View Related

Forms :: Continuous Form - Uncheck Boxes Before Closing

Sep 12, 2013

I have a search form (Form1) that sends the results to another form (Form2) using OpenArgs.

When Form2 opens with the filtered records, it may display 1 or more records (for example, the order number searched for in Form1, the customer may have bought 2 items)

So with my 2 records displayed in my continuous Form2, I have included a bound check box that can be checked by a sales team member of staff if we need to send a replacement item(s).

If the sales person has started the process and checked the box for both records but decides to close the form instead of reordering the goods for the customer (hometime) and decides to Close Form2.

How do I program Access to uncheck both boxes so the table is not updated with the check for each of the items, as this will start a chain reaction and the goods will get packed and shipped. It currently just unchecks the first record if I include Me.ItemSelectedResend = False in the Close form vba code.

I thought about just including a message box on the screen prompting the user to uncheck the boxes before closing, but surely there must be an automatic way in which I can do it.

View 1 Replies View Related

Forms :: Checking For A Filtered Duplicate Value On A Form Before Closing

Apr 11, 2014

Below is some code that I'm struggling with and I get an error message "Type Mismatch".

Description: The database contains multiple projects and the subset of each project is a release. The "PublishedNumber" can't be a duplicate within a release, but it can be a duplicate within the table where the data is stored. There can however be multiple occurrences of 0.

Here's my code:

Dim stLinkCriteriaRelease As String
Dim stLinkPublishedNumber As String
Dim DuplicateNumber As Variant

stLinkCriteriaRelease = "[AssociatedRelease]=" & [AssociatedRelease]
stLinkPublishedNumber = "[PublishedNumber]=" & [PublishedNumber]

[Code] ....

View 3 Replies View Related

Forms :: Parameter Prompt When Closing Form - Access 2010

May 8, 2013

On a pop up form I have a list box. The row source for the list box is

Code:
SELECT tblWebOrder.WebOrderId AS [Web Order No], tblWebOrder.CustomerWebOrderNumber, Format([WebOrderDate],"dd/mm/yyyy") AS [Order Date], tblCustomer.CustomerName AS [Customer Name], tblArea.Area FROM (tblCustomer LEFT JOIN tblArea ON tblCustomer.[PhysicalAreaId] = tblArea.[AreaId]) INNER JOIN tblWebOrder ON tblCustomer.CustomerID = tblWebOrder.CustomerId WHERE (((tblWebOrder.Processed) Like [Forms]![frmSelectWebOrderToOpen]![txtOrderStatus]) AND ((tblWebOrder.WebOrderDate) Between [Forms]![frmSelectWebOrderToOpen]![dteStartDate] And [Forms]![frmSelectWebOrderToOpen]![dteEndDate]+1)) ORDER BY tblWebOrder.WebOrderId DESC;

I have the following "On Click"event on the list box

Code:
Private Sub lstWebOrder_Click()
lngWebOrderId = Me.lstWebOrder.Column(0)
DoCmd.Echo False
DoCmd.Close
DoCmd.Echo True
End Sub

When I click on some of the records on the list box the form closes. On some of the records I get a parameter prompt to enter:

Forms!frmSelectWebOrderToOpen!txtOrderStatus
Forms!frmSelectWebOrderToOpen!dteStartDate
Forms!frmSelectWebOrderToOpen!dteEndDate

I inserted the echo commands to prevent this, but this has not worked!

Why am I getting the prompts? How do I prevent them?

View 4 Replies View Related

Forms :: Search Form When Closing Gives Warning - Cannot Save Record At This Time

Aug 5, 2015

I have a "Search" form that I am using to search through a query in a list box of all of my Customers. Once the record that I am wanting to view comes up I highlight it and click a "View" button to bring up another form with the customers full record. When this form is open I am able to update the customer information and add User's to it if necessary.

My problem comes after I click on my save and close button that takes me back to me search form. I want to close the search form and the error I get is "The record cannot be deleted or changed because table "tblUserProfile" includes related records." I click OK and get a SECOND error stating "You can't save this record at this time. MS Access may have encountered an error while trying to save a record. If you close this object now, the data changes you made will be lost. Do you want to close the database object anyway?"

I have already made my changes and saved them in the form with the customer record so am not sure why I am getting an error when trying to close the Search form.

View 5 Replies View Related

Closing A Subform

Feb 14, 2005

Hello,
I need to close a subform to update the controls on it (deleting and adding), and without closing the main form; without using the "visible" propriety.

Thanks

View 2 Replies View Related

Modules & VBA :: Checking Multiple Subform For Values Before Closing

Jan 29, 2014

I am looking to check 3 sub forms for values and if they contain any then delete them. After a bit of googling I discovered that you should use recordset.recordcount - to which I tried but I get method or data not found - is this a valid method?

My code to which Im using is:

If Me.NoneChargeable_Admin_subform.Recordset.RecordCount >= 1 And Me.NoneChargeable_Manufact_subform.Recordset.RecordCount >= 1 And Me.NoneChargeable_Research_subform.Recordset.RecordCount >= 1 Then
DoCmd.RunSQL "DELETE NoneChargeable_Admin.*, NoneChargeable_Manufact.*, NoneChargeable_Research.* " & vbCrLf & _
"FROM NoneChargeable_Admin, NoneChargeable_Manufact, NoneChargeable_Research;"
End If
DoCmd.Close acForm, "NoneChargeableHrs_frm", acSaveNo
End Sub

View 1 Replies View Related

Main Screen Subform Based On Query Reflecting Changes Only On Closing Database

Jun 25, 2006

I have a problem in reflecting the updated changes on a main screen subform based on a query .These changes get reflected only after closing the access database and reopening it .Tried the requery command. Also made a macro to update the query and run it after the form opens or load but not reflecting change in main screen immediately .I would be grateful if I can get some help on this forumThanks

View 3 Replies View Related

Forms :: Closing Opening Form With Timer Then Opening Main Menu

Apr 7, 2014

I have a Form opening from Access Options. I would like to close this Form using the Timer. The following is the code I have used but it is not working.

Private Sub Cover_Page_Form_Load()
OpenTimer = Timer
End Sub
Private Sub Cover_Page_Form_Timer()
If (Timer - OpenTime) = 5 Then DoCmd.Close acForm, "Cover_Page_Form", acSaveYes
End Sub

Next question. If I can get this to work can I then use a DoCmd to open new Form within the code above or do I need a new process.

View 5 Replies View Related

Forms :: Moving A Subform Within A Subform Of A Form?

Aug 19, 2015

I often move sub forms up and down within a form using something like.

Code:

forms!MyMainForm!MySubform.form.top = 500

However, I am having trouble moving a subform within a subform of a form.

Code:

Forms!MyMainForm!!MySubform!MySubformSubForm.form.top = 500

View 1 Replies View Related

Closing All Forms Except...

Dec 31, 2004

Does anyone know a line of code I could write that would close all other forms, besides the form the user is working on?

I can't stand it when a new form opens up and the old one is still open. I have written individual macros to close the forms, but that is getting rather cumbersome. Any help is greatly appreciated. Thanks!

View 3 Replies View Related

Forms :: Closing All Forms And Saving Records First

Jul 14, 2015

I have had some issues caused by users exiting the database entirely when they realise that they have entered something incorrectly; this in turn has caused problems re-opening the half finished record (the last step of the record creation is to allocate it a unique reference number, which is then used to re-open the record for editing on a point and click form) - now, this is entirely my fault for expecting users to clear up behind them or to exit properly.

So, I am making some changes - when the dashboard form opens it removes the database window close button. I have a separate close button which has the following code:

Code:
Private Sub cmdGoodbye_Click()
Do While Forms.Count > 0
DoCmd.CLOSE acForm, Forms(0).Name, acSaveNo
Loop
DoCmd.Quit
End Sub

However, I would like to add a line to automatically save any records before closing each form - is this possible?

View 7 Replies View Related

Opening & Closing Forms...

Sep 15, 2005

I have an unbound start-up form with a button that I want to open another form. When the user is done with the second form and clicks a close button, I want to bring up the first form.

Q. Is it best to leave the first form open in the background or close and re-open it? (And why?) :confused:

View 2 Replies View Related

Closing Forms As Others Open

Aug 31, 2006

To try to keep a sane user interface I would like to close forms as another form opens.

If I put a Command button on FormA that opens FormB and it is set to find a record on FormB ... how can I close FormA when FormB opens.

I tried putting DoCmd.Close either before and after the code that opens FormB and ...

If I put it before the code - it just closes FormA without opening FormB ... if I put it after the code, if opens FormB and closes it.

Is there a way of saying on a form 'close the form that just opened me'? (like in javascript where you can reference the form with window.opener)

Thanks for any help.

View 4 Replies View Related

Modules & VBA :: Forms Are Not Closing

Sep 11, 2014

I have a form which opens as a pop up when the system starts. On here are several buttons, which open other forms.Some of these just open another form and the user starts using the system, other close that form and open another one, and take go further into the structure of the system, then the forms that open have the same etc.For each of the buttons the code is very similar..For forms that open another one and don't close the main form:

Code:
Private Sub cmdescalations_Click()
DoCmd.OpenForm "frmEscalations"
End Sub

for those that close the form:

Code:
Private Sub cmdStock_Click()
DoCmd.Close acForm, Me.Name, acSaveNo
DoCmd.OpenForm "frmMain_Stock"
End Sub

Just the main of the form it opens changes, and sometimes with ,,,dialog in the options if its required.The opening part works every time without fail, but the form doesn't always close and I end up with two forms open instead of one. If I close the newly opened one and press the button again it works fine. This is purely random and only started a few days ago, up until then it has been working fine.

There is a hidden form that is open as well when the system starts, which check for something on a timer event every 60 seconds. If that event is firing would the focus shift to the hidden form, between me pressing the button and the event firing and the hidden form is getting closed? then the new form opening?

View 2 Replies View Related

Closing Datasheet Forms Within Each Other

Nov 23, 2012

I've got a Datasheet form which has a Datasheet Subform within it. By default, none of the subforms display, and the user clicks the "plus" on the leftmost column. What I'd like to do is prevent a user from having multiple subforms open at once. Basically, when the user clicks to open another subform, the first one closes.

How can this be done?

Also, is there a way to do conditional formatting (either using the wizard or with vba) on datasheet forms?

View 11 Replies View Related

Closing Pop Up Forms After Loading Report

Apr 24, 2006

Hi All.

I have look through the forum but can not find a solution to my problem.

I have a popup form set to "popup" and "modal" "frmJobBookOut" which passes data to a query "qryJobBookOut". In the query there is a field called "job_no" and I have set the criteria to reference the "frmJobBookOut" ** [forms]![frmJobBookout]![job_no] ** and a report "rptInvoice" based on the query "qryJobBookOuit". This all works fine.

The report loads with the popup "frmJobBookout" form still displayed. I know that the popup form is still displayed because I have the setting "modal" and until I click on the close button it will remain on screen.

Is there a way I can close the popup "frmJobBookOut" form after the report has loaded.

I have tried many ways but not the right way.

Many thanks if you can help.

Kind regards

View 2 Replies View Related

Code For Closing All Opened Forms

Jun 28, 2014

I would like to ask if there is a way so that using vba code to be able to closed any opened form in my database.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved