Forms :: Detect If A Form Is Open
Jun 20, 2013
I have a main form (Client) from which I open another form (FilterCriteria). Since FilterCriteria code references the Client form, I want to ensure the user can't close Client while FilterCriteria is open.
I'm thinking I need to intercept Client's 'Unload' event and cancel it - but I can't figure out how to check if FilterCriteria is open.
View Replies
ADVERTISEMENT
Dec 20, 2014
The code below opens a PDF selected from a form. Whatever document number appears in the textbox (FICNo) on the form is the document that is opened when the command button is clicked.It works but I would like to add a message box to say File not found if the document number in the textbox has no corresponding document in the folder (ScannedFiles).
Code:
Option Explicit
Option Compare Database
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_SHOWNORMAL As Long = 1
Private Const SW_SHOWMAXIMIZED As Long = 3
Private Sub CmdOpenDoc_Click()
ShellExecute 0, "Open", "C:UsersDavid.BallDesktopScannedFiles" & Me.FICNo & ".pdf", vbNullString, "C:", SW_SHOWNORMAL
End Sub
How can I modify the code to do this?
View 2 Replies
View Related
Apr 13, 2014
I have a search form that has 8 criteria fields, of which the user can fill (from combo boxes and txt boxes) any number of them to narrow or widen the search.This by the way works perfectly. What I want to have is a message box pop up if the user does not enter any criteria and click search.
I tried stringing multiple if isnull statements together but realised that because I have an onload function that sets all fields to "" the isnull function won't work, so have changed this to the Len function.But when I run it, it just skips straight past the len line and opens the search detail form regardless. I suspect I have the order of things wrong, as it does not throw up any errors when run.
Code:
Private Sub Form_Load()
Me.PCNumberIn.Value = ""
Me.SerialNumberIn.Value = ""
Me.DeviceTypeIn.Value = ""
Me.DeviceModelIn.Value = ""
[code]...
View 5 Replies
View Related
Jul 7, 2005
I was working along a code that seemed to work fine until all of a sudden, the next time I tried it it, it doesnt. It is a simple code really as below which is giong to be the foundation for a selection followed by SQL input into the record source of another form to generate results. I get the following error message
"Microsoft Access cant find the form "Querypurpose" referred to in a Macro expression or Visual Basic Code"
It doesnt make any sense to me since, if I were to take away the " Forms!Querypurpose.RecordSource = SQL" line, than everything works fine. Did I disable any function in the VB editor cos I was playing around with rst before it happened :confused:
Would anyone be able to explain why...thanks so much!
*****
Private Sub Command59_Click()
On Error GoTo Err_Command59_Click
Dim stDocName As String
Dim SQL As String
stDocName = "Querypurpose"
SQL = "SELECT ClientInfo.ClientName FROM ClientInfo;"
Forms!Querypurpose.RecordSource = SQL
DoCmd.OpenForm stDocName, acFormDS
Exit_Command59_Click:
Exit Sub
....
***
View 3 Replies
View Related
Jan 31, 2008
Hey,
I have a form with 55 values entered. On closing the form, I need it to decide if this is a new record. If it is a new record, it loads all 55 values into an array. If all values are above 20,000, it goes ahead and closes the form. If any are below 20,000, it writes the record to another table and brings up that form to add add a comment.
Every thing does as it should except determining if it is a new record. What property will trigger it properly? All the properties I have tried either triggers it on all the records (even if it is an old record) or it does not trigger it and closes without prompting the code.
View 6 Replies
View Related
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
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
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
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
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
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
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
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
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
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
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
Sep 17, 2014
I am trying to have cascading forms running on my database. The first form adds a new staff member. When you press the next button this happens...
Private Sub Command12_Click()
DoCmd.Close
DoCmd.OpenForm "Frm2"
End Sub
But I want it to open Frm2 using the ID from the previous form. The stumbling block for me is I close the first form before opening the next so I cant pass the ID across.
View 2 Replies
View Related
Dec 21, 2006
I have several forms that open in the middle of the form instead of at the top in the first field. Any ideas to correct this problem?
View 2 Replies
View Related
Dec 24, 2014
how to give the option to open either forma or formb with a command button.
View 1 Replies
View Related
Jun 3, 2014
Im using the below code to open a from depending on what option is selected on a combobox.
Code:
Private Sub DirectPCombo_Click()
Dim cboVal As String
Dim stDocName As String
cboVal = Me.DirectPCombo.Value
Select Case cboVal
Case "One"
[code]....
If you select the first item [One] it will open the correct form [TestOne]. But when you select any of the others an error comes up saying that the name is no a form. So I added
Code:
DoCmd.OpenReport stDocName
But the no items would select.I know If split the reports form the forms and make two comboboxes it would work, but it would be better it both could be in the same combobox.
View 2 Replies
View Related
Sep 13, 2013
I have a continuous form that is based on a query. I would like to have an open button so that you can select a record on the form and that particular record opens up in a new form. How do I do this?
If this cant be achieved would I be able to make a form open that shows a particular record based on the query and you just press next record to view the other records that are a result of the query?
View 6 Replies
View Related
Feb 8, 2015
I have a main form. It's only contents is an unbound combobox, and it's used to filter down (via a query) the details in it's sub form (I'm using it to load different account information, rather then type it in all the time).Anyway, I also have another form (Dashboard, or mainmenu) which summarises activity within Each account and is displayed via a datasheet.
What I'm trying to do is double click the accountname (on the main menu)which will then open up the necessary form and load the value from the datsheet accountname, in to the newly opened forms cbo, where I can apply the form to requery on load.I'm going to have to DIM the value, and docmd.openform etc...
View 13 Replies
View Related
Jun 3, 2015
How to make application such that only a form is opened (not as a tab in access) just like pop up feature of a form. i have only one form in my application...
View 2 Replies
View Related
Dec 5, 2014
I have made a main form(ApplicantList) and another form(ApplicantDetails) for new applicants which the the DataEntry Property set to Yes now my concern is If double click the LastName of FirstName value on the main form I want to popup the second form which has have all there information..
View 10 Replies
View Related
Jul 10, 2015
I working in a database. I want to open another database and go directly to a specific form (not the default form). How do I make this happen? Below is what I have so far.
Dim accapp As Access.Application
Dim appname As String
Set accapp = New Access.Application
appname = "M:MPFMPF_Mgmt_Info_SystemSGLIPrepToolSGLIPrep Tool.accdb"
accapp.OpenCurrentDatabase (appname)
accapp.Visible = True
View 3 Replies
View Related
Jun 12, 2014
I am trying to open a form from my main form and populate fields from one to the other (then press a button).if the form is opened in dialog mode then the code won't run to populate the form (until it is closed or not visible).
The main form is showing an address, but the user can click a button to amend this. Once clicked, the Property Form is opened - I don't want the user to need to fill in all the address details again. I want this pulled through from the main form so the user can make an amendment, then save the new address.
Code:
DoCmd.OpenForm "frmPropertySearch", , , , , acDialog
With Forms!frmPropertySearch
.Form.Visible = False
If Not IsNull(Me.Building_Name) Then
strBuildingName = Me.Building_Name
.txtBuilding_Name = strBuildingName
End If
End With
View 3 Replies
View Related