Modules & VBA :: Pass Value To Form That Opened A Popupform?

May 9, 2015

I have two subforms in a tab formation sitting on a main form. They can both open up a single popup form (via a button) and that popup form is opened via openargs with the autoID field.

What I need to do is pass back a value on the popup forms [On Unload] event to the subform which opened it.

As the popup form is Modal, the subform which opened it can't be changed.

Am I right in thinking I can pass back the value to the form which had previous focus?

Previously, to pass a value from a popup form to a single form I've been using

Code:

If CurrentProject.AllForms("MyForm").IsLoaded Then
do this
else do this
end if

But in this instance, how do I code the On Unload event in which to tell Access which form opened up the popup form, and pass a value back to it?

I'm guessing
Screen.PreviousControl.SetFocus
has something to do with it?

View Replies


ADVERTISEMENT

Queries :: Pass TempVar To Query That Is Selected From Previously Opened Form

May 23, 2013

I'm trying to create a query that supplies a form with data. I want to pass a TempVar to the query that is selected a from previously opened form.The TempVar is setting correctly and I can see if this if I place a textbox (NewCID) on the form showing the TempVar. The problem I have is displaying on the records according to that TempVar. If I set the query manually, i.e. "|Test|" then records are displayed but if I use the TempVar, which also displays |Test| then no records are brought back.

think it's something do with the vertical bar and that fact the field I'm searching on is a memo field, both of which I've no control over. I also have to use the Like statement because of this.Here's the query that works...

SELECT *
FROM dbo_ASSETS
WHERE ASSET_CID Like "|Test|"

and the one that I want to use, that doesn't...

SELECT *
FROM dbo_ASSETS
WHERE ASSET_CID Like [TempVars]![tmpvarCID]

I've even tried referring to the textbox instead of the TempVar, i.e.

SELECT *
FROM dbo_ASSETS
WHERE ASSET_CID Like [Forms]![AssetsCID]![NewCID]

but that doesn't work either.

View 2 Replies View Related

Modules & VBA :: Saving Combobox After Form Is Closed And Re-opened

Sep 26, 2013

I have a main form called frmAF54. In this main form I have a subform named frmPassdown. The subform record source is from a table called tblCards. This table contains many different cards. I have a combobox called lstOpCard in the main form as well. The combobox lists all of the different cards in "tblCards". I have a button called "buttonFilter".

A user opens the form and clicks (or selects) the different cards in the combo box "lstOpCard" that they want to filter for. Once their selections are made, they can click the "buttonFilter" button and the subform "frmPassdown" will be filtered based off of their selections.

The filter is applied using the IN() function as shown below:
Me.AF54PassDown.Form.Filter = "[OpCardID] IN ( " & sTemp & " )" --sTemp is a string containing the keyIDs of the cards selected.

My problem is that people will be opening and closing the form throughout the day / week. When the form closes, it loses the applied filter. How can I have my filter on the subform be saved after the form is closed and the filter is still applied when the form is opened later?

View 1 Replies View Related

Modules & VBA :: Export From MS Access To PDF With Set Variables From Opened Form

Jul 9, 2015

I have been at this for almost 3 weeks now and I'm having great difficulties trying to get this right and working. First let me explain what I am doing and what I am trying to do.

Firstly, I am making a Maintenance database using MS access software, what I have are tables, forms and no queries or report existing so far. The forms and tables all work correctly.

After the form (Job request) has been completed I need to save/export into PDF so I am able to hyperlink it against its existing asset card elsewhere.

now what I have done is Created button, on event "on click" I have tried to go to macro builder

ExportWithFormatting
Objet Type: Form
Object Name: FrmMachineFault/GenMaint
Output format: PDF
Output file:
Auto Start: No
Template File:
Encoding:
Output Quality: Print

when I click this button it opens to save to and it works perfectly but I have to manually type the file name when it gets to the Save to section.

What I want it to do is define the name by the existing fields in the open form. Example Closed date, Effected area, Asset and title.

What I am hoping for is something like this.

10/07/15_Foundry_Furnace_LPG_Leak
(Closed date)_(Effected Area)_(Asset)_(Tittle)

Is this possible?

View 14 Replies View Related

Modules & VBA :: Pass Combo Box To Another Form Always Null

Mar 25, 2015

I want to pass the Combobox value of one form to a textbox on another using the where condition. Using the break in VBA, the value of the combobox (in this instance "two") shows as null. the control of the combobox is [cboSubCategory] and I want it's value to pass to another form "tblCategoriesSub" (aware of the incorrect reference, as used wizard quickly - but will change if I can get it to work) to the "SubCategory" field.

View 5 Replies View Related

Modules & VBA :: Pass Data From A Subform To New Form

Sep 26, 2013

I'm working on a database that will be used when maintenance needs to be performed on our test equipment. So far, I have a form set up for the associates to track when a maintenance action has been performed. The top section of the form contains basic data about the part and there is a subform that lists the actions that need to be taken on the piece of equipment. In the subform, the associate can mark whether the action is complete or not.

If the action is marked incomplete, I wanted a separate form to appear for them to track why an action cannot be performed. If possible, I would like this separate form to automatically show the equipment ID and the action that was missed. However, I'm having difficulty getting the data to copy from the subform to the Exception form. Is this something that is possible to do?

View 2 Replies View Related

Modules & VBA :: Open One Database Form Another And Pass Variable To It

Feb 19, 2014

I have a button on my main db, that opens a second db using hte following code:

----------------------
'Dealing with external objects, use inline error trapping
On Error Resume Next
Dim appAccess As Object

Dim db As Database
Dim strAppPathName As String
Dim strAppName As String
Dim strTimesheetPathName As String

[Code] ....

This code works great to open the other db, and handles wheter the other db is already open or not, but I cant seem to pass the variable to the other db using the startup switch /cmd.

I suspect if I used the shell method it would pass the cmd , but I havnt found any way to test if the db is already open with the shell method.

How can I pass a variable to the other db when opening it using VBA?

View 10 Replies View Related

Modules & VBA :: Form Filter And OrderBy Pass To Report

Aug 16, 2014

I am able to filter a data on a continuous form using drop downs and then the following code attached to a cmdbutton to create a report of the filtered data.

Code:
Private Sub Command30_Click()
Dim strWhere As String
If Me.Dirty Then Me.Dirty = False
If Me.FilterOn Then strWhere = Me.Filter
DoCmd.OpenReport "rptconveyorerrors", acViewReport, , strWhere
End Sub

On the same form where I filter the data i can sort it by clicking the headings aswell, however when i generate the report using the above VBA it doesn't take the sort with it and just generates it without the sort.

I am using the following VBA to sort my form

Code:
Me.OrderByOn = True
If Me.OrderBy = "[empname] DESC" Then
Me.OrderBy = "[empname] ASC"
Else
Me.OrderBy = "[empname] DESC"
End If
Me.Refresh

I thought it may be possible to use the following sort of VBA to pass the sort however i cant get it to work:

Code:
Private Sub Command30_Click()
Dim strOrder As String
Dim strWhere As String
If Me.Dirty Then Me.Dirty = False
If Me.FilterOn Then strWhere = Me.Filter
If Me.OrderByOn Then strOrder=Me.OrderByOn

View 1 Replies View Related

Popupform

Oct 24, 2005

Hi,

Im working on a form. This form has a button. When the button is clicked, a popup form, just a smaller sized form needs to open. The problem is that the main window is maximized. When i try to open the small form, it opens or maximized, or it also resizes the mainform to dialog.

can this be fixed. I want the main to stay maximized, and the smallforum to just popup.

Thanks for your reply!

View 4 Replies View Related

Modules & VBA :: Pass A Value From Form To Form

Aug 31, 2014

There's a button(Button1) on the main form (Form1) and on the second form (Form2).On Form1, I've got a link(LinkToForm2) to Form2.When people click on LinkToForm2, I want access to open Form2 and hide/show Button1 depending on whether it is shown/hidden in Form1.

Is there a way to, maybe, set a value on Form1_Deactivate (depending on whether Button1 is shown/hidden),So that, on Form2_Activate, it can check that value and hide/show Button1 accordingly?

View 3 Replies View Related

Modules & VBA :: Pass Value From Form To Form

Nov 6, 2014

I have two form

first form contains many textboxes
second form is continuous and contains two textbox

I make a shortcut to the second form so i can open it with Shift+F1

Now when the form 2 open i want to double click on any row then the form 2 will close then the information well be copied to two specified textboxes in the form1

N.B form1 should still be opened when i open the form2

View 3 Replies View Related

How To Requery Mainform From Popupform?

Aug 22, 2006

Hi!

I have a mainform, with a popupform, on which I want to select a record/post
to work with on the mainform. I have managed to select the actual post on the popup, but i dont know how to make the mainform navigate to that form.


How do I easiest accomplish to make the mainform navigate to the record I've selected on the popupform?

thanks for your reply ;)

View 3 Replies View Related

Modules & VBA :: Send Email When DB First Opened

Feb 11, 2014

I have the code for sending an email but I only want to send a single email when there are records in a query and only when the database is first opened.

I hadn't considered this in my design so what structural requirements would it require if any?

View 5 Replies View Related

Modules & VBA :: Force Subform To Be Opened On First Record

Aug 20, 2013

I have an issue with my subform, that when opened inside the main form, I want the form to be opened on its last record (which works) and then I want the subform to be opened on the first record regarding that record ID coming from from the main form. The relationship is many to one, coming from the form to the subform. I have tried several code on many events on the subform so it can goes to the first record, but it sometimes goes to the first, othe times ot goes to the third, i don't know why. I have tried the following:

Private Sub Form_Load()
DoCmd.GoToRecord , , acGoTo, 1
En Sub

or
DoCmd.GoToRecord , idsPreguntas, acFirst 'idsPreguntas is the control name of the record

or
DoCmd.GoToRecord , , acFirst

View 8 Replies View Related

Modules & VBA :: Making Already Opened Excel File Invisible

Jan 14, 2014

I have the following code. In the Else part of the code, after the wb.Activate line, what code can I place here that will assign wb.Name to the objExcelApp object ao that when the line .Visible = False kicks in, it will make the already opened MS Excel file invisible.

Code:
Dim strExcelFile As String
Dim wb As Workbook
Set objExcelApp = GetObject(, "Excel.Application")
If objExcelApp Is Nothing Then
Set objExcelApp = CreateObject("Excel.Application")
objExcelApp.Workbooks.Open FileName:=strExcelFile

[code]...

View 2 Replies View Related

Modules & VBA :: Mail Merge - Database Placed In A State By User That Prevents It From Being Opened Or Locked

Jun 19, 2014

I have the following code which errors on line

Code : .OpenDataSource Name:=CurrentProject.FullName, SQLStatement:="SELECT * FROM [qryMailMerge]"

The error (Error has occurred: The database has been placed in a state by user 'Admin' on machine 'W74XXXXXX' that prevents it from being opened or locked) appears in the Word document.

Code:
Public Sub CreateWordToPDF(strWordFile As String, strPDFFile As String, strSQL As String)
'Call CreateWordToPDF("C:Doc1.doc", "C:Doc1.pdf", "SELECT * FROM [qryMailMerge]")

Dim objWord As Word.Application
Dim docWord As Word.Document
'Open MS Word using early binding.
Set objWord = New Word.Application
Set docWord = objWord.Documents.Open(strWordFile)

[Code]......

View 8 Replies View Related

Update Excel Spreadsheet That Link To A Form While Users Having Form Opened

Sep 17, 2014

What is the best way to accomplish this? I have a database that split into the Front end and the Back end. The form that the users entering the information uses the queries from two sources. One is the a table within Access and the other is an excel spreadsheet that I link to it. How can I update /replace the Excel spreadsheet while users are using the form of the front End?

View 9 Replies View Related

Form Won't Stay Put When Opened

Nov 8, 2005

I have a Main Form that utilizes tabs to control several other forms by opening, closing and making them visible/invisible. One of the forms needs to be closed when its tab on the Main form is unselected. The problem is that once the form is closed, when it opens up again it opens right infront of my Main form's tab control so I need to move it down an inch to get to the tab control.

I've positioned this form where I want it and saved it numerous times. But once I select the tab, it opens up right ontop of the Main form's tab control again. I have the AutoResize set to No and the Auto Center also set to No.

Any ideas how I can get this form to stay put?

Any help is most appreciated. Thanks.

View 2 Replies View Related

Formatting A Form Before It Is Opened

Jan 2, 2006

hopefully someone will know what to do...

i have a form that has a bunch of check boxes and labels that are hidden to start with,and become visible when a confirmation button is pressed. Wen i set this up in the design view i.e making their visible status = false, everything runs accordingly - however when the next person comes to update their details the form will not format properly. i think the reason has something to do with the check boxes having different visibilty statuses after the initial confirmation i therefore used code on the form open event

If Check2.Visible = True Then

check.Visible = False
End If

however this tends to fail at the first checkbox, however if i then press run on the VBA screen everything else seems to then run fine and so only the first checkbox is left visible...

can anybody help....

thanks in advance i hope i have made myself clear..

View 2 Replies View Related

Form Size When Opened

Jan 18, 2006

Hi
Is there a way I can make a form open to maximum size to fill the work area without click the forms Max button


dave

View 1 Replies View Related

Which Tabel Was Opened, Who And When Opened It

Apr 26, 2006

Hi
I want to see Which tabel was opened, who and when opened it.
And if possible I want to see what is changed.
I want to see as I mentioned above as a "log file"

Thank you
Sedat ONAT

View 3 Replies View Related

Viewing Form When Database Is Opened

Sep 2, 2005

Hey there, when a user opens my database, I want the form to enter records to automatically open. Can someone plz help with that... thx

View 3 Replies View Related

How To Disable Form Window While The Second One Is Being Opened?

May 17, 2006

Hi all, I have a main form which contains buttons to control all other window. I'd like to prevent user to work on two forms at the same time. Can anyone advise me how to disable the main window while the second window is opened?

thanks

View 3 Replies View Related

Forms :: Refresh Form That Is Already Opened

Mar 17, 2013

I have forms that show commitments by Client, by Cost Centre, by Provider etc.

If I add new commitments or edit commitments it is done through the Commitments by Client form, as all other forms lead back to this one.

To create a new or edit an existing commitment, it is done through a Commitment Form, which goes into a query (query A)which does all the calculations. My client form has subforms based on Query A, however my other forms (commitments by Cost Centre etc) have subforms which have querys that are based on Query A . I hope that made sense.

My problem is that If I edit a commitment, the client form and subforms refrlect the changes imediately, even though they are open and I can see them changing when I change the commitments. However the other ones don't unless I close them and re-open them.

My navigation within the database is based on once a form has been opened it is set to be invisible untill called on again (i.e. visible = False).

How to requery all the forms without having to close them.

View 1 Replies View Related

Go To Last Active ID When Form Is Opened Or Refreshed

Sep 14, 2012

I have main form with everything on it using tabs and so on and everything is working fine. What I would like to do is this. Since I am jumping frequently between different records and many actions require main form to be reopened or refreshed and when this happens the form goes to random records, I would like for form to go to last record i was on before it was refreshed or opened.

I was thinking using tempVars to set the id but the problem is that I am not sure what can trigger the TempVars since I am jumping between the records and not making any changes to them.

View 3 Replies View Related

Update Form Everytime Database Is Opened

Jan 24, 2006

One of the forms in my database has a calculated text box control. The calculation is conditional, one condition being based on current date. One of the queries display that calculation. If the the form with the calcualted control is not opened before running the query, the calculated control uses the day the form was last opened as the "current date" which is not what I want. I want to do one of two things:

Either: (Preferably): update the form everytime the database is opened, so that the current date is actually the current date and not when the form in question was last opened.

Or: Update the form first before the query in question is run. This is not preferred because, if I use the calculated control in another query or something, I have to have another "update" step.

View 4 Replies View Related







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