Closing An Open Form From Another Form That Is Open

Dec 17, 2004

Is there a way to close a form that is open from another form that has the focus. I tried using the Unload event, but I received an error message "Cant load or unload the object". I would appreciate any help!

View Replies


ADVERTISEMENT

Open Form While Closing Form

Oct 26, 2006

this has to be simple but i can't get it to work...

i have a selection form (frmSelection) with a combo box...the user makes a selection from the combo box and based on that selection another form opens when they click next...i have a Select Case under cmdNext_Click()..here's a sample of what that looks like:
Select Case cboVioCat.Value

Case 1 ' loads frm_vw_lab_all_facility
frm_Name = "frm_vw_lab_all_facility"
DoCmd.OpenForm frm_Name, acNormal
Case 2 ' loads frm_vw_lab_all_other
frm_Name = "frm_vw_lab_all_other"
DoCmd.OpenForm frm_Name, acNormal
Case Else
strMsg = "Please make a selection from the list"
MsgBox strMsg, vbInformation, "Oops!"

End Select
now what i'd like to happen is say the user selects the first option "Case 1", the new form opens...this works perfectly...but what i'd also like to happen is frmSelection to close - it is no longer needed...i have added DoCmd.Close within each Case and after the End Select but none work...it appears as though it is closing the new form, frm_vw_lab_all_facility...what am i missing here?

View 3 Replies View Related

Forms :: When Open A Form / Want To Open Another From At Same

Jan 14, 2015

when i open a form i want to open another frm at the same time. i have a main form with some buttons in it. when i click on a button and a form opens then i am not able to click on a button to open other forms from the main form.

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 :: Closing Already Open Workbook

Aug 7, 2014

I have a workbook which is already opened and I want to close it. the code that i have is (see below) is not working.

Code:

Function CloseExcel(sExcelFile As String) As Integer
Dim XLapp As New Excel.Application
Dim ObjXL As Excel.Workbook
On Error GoTo ErrorTrap
Set ObjXL = XLapp.Workbooks.Open(sExcelFile)

[Code] ....

View 4 Replies View Related

Modules & VBA :: Closing Already Open Excel File From Access

May 25, 2015

I want to delete an excel file from within access vba. Problem is that if the file is open, it obviously cannot be deleted. so I need to check to see if that specific excel workbook is open and if it is, I want to close it before I can delete it.

All of the answers here involve creating an excel object and opening it before closing it. If I do that all that happens is a second instance of the workbook opens then closes leaving the originally open workbook still open.

Sub xx()
Dim XLapp As New Excel.Application
Dim ObjXL As Excel.Workbook
Set ObjXL = XLapp.Workbooks.Open("C:dropboxexcelimport.xlsx ")
ObjXL.Application.Visible = True

[Code] .....

The above code demonstrates my problem, if the import.xlsx file is already open then the code just opens another instance of this workbook and then closes it again leaving the original workbook open and as such cannot be deleted.

View 3 Replies View Related

Forms :: Button In Form To Open Different Form And Chose A Customer Based On Last Form

Mar 26, 2013

Basically I have a Customer Form, which I have a New party button on it,this button opens up the party form to a new party, what I would like it to do is open up a new party but make the new party for the customer I had selected in the previous form.I have tried the GoTo macro's but cannot seem to get it to work.

I am thinking on clicking the button it will need to get the Customer ID, and then open the party form, create new party, and paste in the Customer ID, which then updates the Name - Date - Address - Company Fields.

View 5 Replies View Related

After Open Open Another Form

Jul 26, 2005

I want to open another form automatically when an initial form opens, both are non popup) I have tried open and load events - but still the calling form appears on top of the called form.

How do I get the two forms to open form 1 and then form 2?

Also I cannot use the timer event as this is doing something else.

Thanks

View 2 Replies View Related

Forms :: Open Blank Form Based On Value In Text Field In Main Form

Jun 6, 2013

I have one table containing name of restaurant with its address etc. Then i created another table to list out the restaurant workers names and details. Just as an example,

Table:Restaurant
Restaurant name
Address line 1
Address line 2
Restaurant #
Website

Table:StaffContact
Staff Role
Name
speciality
email
phone

I have the main form that has all the restaurant details only. And i have another form containing the Staff information. Please note the two table have a relation and it works well.

Now to make it user friendly(basically easier for the lazy ones), I dragged the staff contact form on to my main form and displayed it as a datasheet(basically a sub form).

Now, my boss does not want users to add/delete on this sub form(datasheet). So,he wants me to create buttons to open new record of staff for each restaurant(new form)

My issue is with opening a new record to enter a new person to the staff list and give them a role as well in form view.The new form has

So i ran a Macro, with open form with Where condition

Code:
[Staffcontact]![Rest Name]=[Forms]![MainForm]![RestaurantName]

But, it does not work .

View 2 Replies View Related

Forms :: Continuous Form With Command Button On Each Record To Open Another Form

Jul 30, 2014

I have a continuous form in which I put a command button for each record called "detail". I would like to click on the "detail" button and make it open another form containing all (and only) the info on this record.

At first I refused to use an "id" to link both forms, but finally I added the "id" in the table... however still does not work.

continuous form: "04 - GASTOS_BUSQUEDA"
id field on continuous form: "Gastid"

pop-up (details) form: "GASTOS_EDITAR"
id on pop-up (details) form: "editar_id"

This is what I have tried on the "click" properties of the "details" button field (called "btn_editgs"):

1)
DoCmd.OpenForm "GASTOS_EDITAR", acNormal, , "[editar_id] = " & Me.Gastid

2)
DoCmd.OpenForm "GASTOS_EDITAR", , , "[editar_id]=" & Me.Gastid

3)
stLinkCriteria = "[editar_id]=" & Me![Gastid]
DoCmd.OpenForm "GASTOS_EDITAR", , , stLinkCriteria

4)
Private Sub btn_editgs_Click()
On Error GoTo btn_editgs_Click_Err
Dim strWhere As String
strWhere = "[editar_id] = " & Me.Gastid
DoCmd.OpenForm "GASTOS_EDITAR", , , strWhere
btn_editgs_Click_Exit:
Exit Sub
btn_editgs_Click_Err:
MsgBox Error$
Resume btn_editgs_Click_Exit
End Sub

View 9 Replies View Related

General :: Modal Form - Open Concrete Form And Pass Value To Control

Jun 21, 2013

I have modal form - frmZlecenia

I would like to copy one control, then close this form, open concrete form and pass value to control.

My code is

Private Sub Menu_Click()
DoCmd.OpenForm "frmZleceniaMarzenaNawigacjaPD"
Forms!frmZleceniaMarzenaNawigacjaPD.Form!Imie = Me.Imie
Forms!frmZleceniaMarzenaNawigacjaPD.Form!Imie.SetFocus
DoCmd.Close acForm, Me.name
End Sub

The problem is, still opens the previous form, not form "frmZlecenia"

e.g If I open form x then from this form I open my modal form "frmZlecenia" and then I will click "menu" button - now form "x" is open :/, but should be "frmZleceniaMarzenaNawigacjaPD"

There is some way to open concrete form from modal form?

View 1 Replies View Related

Open Form Command Button Fills In Text And Date Fields From Previous Form

Apr 27, 2005

I currently have two forms: frmE_SAFind and frmE_SAOrder

frmE_SAFind shows results from a query including fields [txtIDPO] and [dtmDate]
Example:
IDPO Date
btnOpnFrm 6543 2/1/05
btnOpnFrm 5681 1/1/05

frmE_SAOrder shows order details including [txtIDPO] and [dtmDate]

I have a open form command button set up on [frmE_SAFind] that opens [frmE_SAOrder]. Is it possible for me to modify its properties so that when the open form command button is clicked, the order details in [frmE_SAOrder] will represent the order that the user is selecting via the btnOpnFrm command?

Example: If I click btnOpnFrm for 6543, [frmE_SAOrder] will show me PO 6543 details.

Hopefully I made myself clear enough to understand. Thanks for your help!

View 1 Replies View Related

Forms :: Navigation Form - BrowseTo Command To Open Up A Form In Built-in Subform Module

May 3, 2013

I'm working on the Navigation Form template in Access 2010, which is new to me. It appears that one needs to use the BrowseTo command to open up a form in the built-in subform module. I'm trying to create a couple of buttons where each button opens a form in a different data mode; one in read-only and one in add mode. Here is the syntax I used for read-only:

DoCmd.BrowseTo acBrowseToForm, "frmSales","frmNavigation.NavigationSubform", , ,acFormReadOnly

frmSales is the Sales form I want both of the buttons to open and frmNavigation is the Navigation form. It seems to be ignoring the data mode part at the end however. It only will open in Edit mode. Is there something I'm doing wrong with this command?

View 3 Replies View Related

Forms :: Double Click Record In One Form To Open New Form?

Jan 27, 2014

I am trying to create a proposal log for my company to make things easier to track. I have made a multiple items form to list the proposals. I want to be able to double click the record to open up another form (that i have already created) that shows the information from the proposal table and the proposal details table. So.....

I want to double click the field named "Proposal Name" and have it open up to form i have called "proposals details form".

View 3 Replies View Related

Forms :: Open New Form With Record Data Sorted From Another Form?

Apr 2, 2014

I have a main form[frmResearchNotes] with combo box controls that filters a query populating [subfrmNotelist] containing several records from the filtered query. From there, I double click on a field within one of the remaining records, [CompanyName] for example, and it opens the new form[frmNoteDetail]. The problem is that second form is not displaying that selected record. The second form's record source has been set to the same query so when it loads, it displays the same info but it's displaying the 1st record out of the entire filtered list, not the record I clicked on in that list.

I figured I could use the strWhere function to copy the record I selected in the event procedure and then open the new form with those details. Not sure how to actually do this with VBA or if it's even the correct approach.

View 14 Replies View Related

Forms :: Open Form Directly Inside Navigation Form?

Oct 28, 2013

I would like to know if it's possible to open an specific subform inside a navigation form using an event.

I also need to to this using macros ( really can't use vba in this project =/)

Form example:

the main form has "nav_opt1", "nav_opt2", "nav_opt3"

By double clicking a record in "nav_opt1", it will open "nav_opt2" with some filters (but all in the same window), as if I was just browsing through the navigation forms usually.

View 1 Replies View Related

Creating Form To Target Current Record Open In Another Form

Apr 17, 2014

I have three objects a Main_Table , ClientDataForm and a MapForm all three share a common ClientID number

From that Main_Table I have created a ClientDataForm form which I enter all Data

From ClientDataForm I wish to create a button on it which runs a Macro that Saves ClientDataForm Record and then populates another form named MapForm with whatever record is currently open in Form One whether a newly created one or previous record.

How would I write this code for that button? Also why I would write it that way?

View 3 Replies View Related

Open Previous Form From Current Form Sub Form

May 7, 2005

I have a fault form which the user enters details of a fault. When the fault form is submitted the data is saved in the relevant table and the form is cleared so that the user can enter the next fault. On the fault form i have a subform which displays the faults previously entered by the user. I want the user to be able to click on an entry in the subform and open the orignal fault form and see the data that had been entered. How can i create this functionality??

View 9 Replies View Related

Event From One Form That Opens Another Form: How Do I Open To The Right Record?

Nov 7, 2006

I have code for a button click event. Essentially I have a main table form that I use to enter customer data and info. I also have a button that I use to add that customer to a separate table that I use for special Customers. My code copies all the data I need copied to my other table, so I wont waste space here typing my code that actually copies the data to the new table. What I will list are the two commands I am using after that code, to close the current form (the one with the button) and open the form for entering special customer information (the form to edit data on my other table). It works flawlessly, but when it opens the other form, it opens to the first record. I want to know how to make it open to the record which I was viewing when I clicked the button to copy the data.


DoCmd.OpenForm "Special Customer Data Entry", , , Number = Me.Number
DoCmd.Close acForm, "Customer Data"

View 9 Replies View Related

Open Form Not Adding Record And Use An Add Button On Form

Aug 2, 2006

I have a database with three tables

table 1 (form1)
reference (PK) auto number

table 2 (form2)
Reference (fK)
workbook reference (PK) auto number

Table 3 (sub form within in form2)
Reference (FK)
workbook reference (fK)
data Reference (pk) auto number

Each table is a form that is linked via the keys. On form 1 i have a button that is to open the form2, which it does but every time i open the form a new record is added. Why and how do i prevent this.

Then what i want to do is add a button for a new form on table 2 form but use the same reference as the record as presently displayed. How do i add new record using the same Reference but new workbook Reference?

Thanks is advance

View 1 Replies View Related

Need Code To Open TeacherDetailFrm Form Main Form.

Jun 11, 2007

Hi
I need code to open TeacherDetailFrm form Main form.

I have TeacherStudentSubFr*m on the Mainform, FirstNameTxt on the TeacherStudentSubFr*m, and TeacherDetailFrm.
I need code to open the TeacherDetailFrm By double click on the FirstNameTxt.

I use this code but no data come and query dialog box come.

Private Sub FirstNameTxt_DblCli*ck(Cancel As Integer)
Dim DocSubForm As String
Dim DocText As String
DocSubForm = "TeacherDetailFrm"
'DocText = "[Result]=" & "'" & Me![result] & "'"
DoCmd.OpenForm DocSubForm, , , "[ FirstNameFld ]=forms![TeacherStudentSubFrm]![ FirstNameTxt]"

End Sub


I like to upload the file but no way in this forum

View 2 Replies View Related

Forms :: Open Second Form On Related Field From First Form?

Aug 22, 2013

how to write code to open a second form on the click of a button on the first form and specifically to continue on the record set I am focusing on.

I have 2 tables. The first is tblAccount (fields: AccountID [the PK]; AccountHolder) and the 2nd is tblUser (fields: UserID [the PK]; UserName; AccountID). They are linked so that one account can have multiple users. Each has a respective form; frmAccount and frmUser.

My goal is that once the AccountHolder field has been populated in frmAccount I can click a button to open frmUser with the AccountID field already showing in the form header.

I have managed to do something similar by selecting from a combo box before but I am having trouble making this work after directly populating the AccountHolder field and using an open Form button.

View 2 Replies View Related

Forms :: Open A Form Based On Current Form?

Nov 23, 2014

When I have a form called "SiteForm" open and click a button "NewCalloutButton" I would like it to open up a form called "CalloutFormEntry"

I've done this using

Private Sub cmdOpenDetail_Click()
DoCmd.OpenForm "CalloutFormEntry", , , "CalloutID = " & Me!CalloutID
End Sub

However this brings up all the records linked to the calloutID

What I'm after is to open the CalloutFormEntry from the SiteForm in a dataentry kind of format but to carry over the current SiteID based on which site is open on the SiteForm. That way there's no user error logging callouts to incorrect sites.

View 9 Replies View Related

Forms :: Open A Form With Subform From Separate Form

Oct 23, 2014

I'm trying to open a form with a subform from a separate form. I've never had any issue before, but all of the sudden, the subform doesn't seem to open immediately. I get the error

Code:
Method 'Form' of object '_SubForm' failed.

After that, it opens (subform and all), but some calculated text fields just say "#Name?#"
The only thing I did today was add a command button to that subform.

When I try opening the form (or subform) from the navigation pane, I get

Code:
The expression On Current you entered as the event property setting produced the following error:

A problem occurred while Contracts was communicating with the OLE server or ActiveX Control

When I step through the code, it doesn't reach the On Current event.

View 5 Replies View Related

Open Form To Matching Record On Another Form

Jun 7, 2007

I have 2 forms.

The first form is called "entry"
the second for is called "play"

I am trying to open the play form on the click of a button so that it displays the records matching the value set for the [playid] field in both forms.

Can anyone help me with the code?

View 4 Replies View Related

Open Form On Menu Then Close Old Form

Feb 19, 2005

I've a custom menu bar from which I can choose any of my forms. However when you choose a new form the old form stays open, sloppy in my mind. Is there any way i can choose the new form from the menu bar & close the previous form? I've tried to close on deactivate, w/ no luck.

View 2 Replies View Related







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