I have created a form per MS Access help for search criteria for a reportand it works great. But is there a way to do it for an edit form? I have duplicated the method and can get 95% of the problem solved however, the "Cancel" button won't work. I can close out of the critera form but I get left hanging in the original edit form. I have set it up in VB on open in the edit form. I use the same criteria form for different edit forms and it works great until I hit the "Cancel" button in them.
7 3425
I have created a form per MS Access help for search criteria for a reportand it works great. But is there a way to do it for an edit form? I have duplicated the method and can get 95% of the problem solved however, the "Cancel" button won't work. I can close out of the critera form but I get left hanging in the original edit form. I have set it up in VB on open in the edit form. I use the same criteria form for different edit forms and it works great until I hit the "Cancel" button in them.
Please post the code behind your Cancel button. Thanks.
I used the instruction from the ms Access help for "create a form to enter report criteria" and works great for a report, but I need it for a form. Below is how I set it up with my form of "srchVariable".
-------------------------------------
Create a macro for the Cancel button.
How?
This macro closes the form. Give the macro a name, such as Cancel, and click the Close action. Then set its action arguments as follows:
Argument Setting
Object Type Form
Object Name srchVariable
Save No
-------------------------------------
Create a macro that opens the Sales Dialog form.
How?
Begin by clicking Macro Names to display the Macro Name column. Type a macro name, such as Open Dialog, in the Macro Name column, and then click the OpenForm action. Then set the action arguments as follows.
Argument Setting
Form Name srchVariable
View Form
Data Mode Edit
Window Mode Dialog
Add a second action, CancelEvent, that cancels previewing or printing the report when the Cancel button on the form is clicked.
If the Condition column is not displayed, click Conditions .
Type the following expression in the Condition column:
Not IsLoaded("srchVariable")
Note IsLoaded is a function defined in the Utility Functions module in the Northwind sample database. It's used to check whether a form is open in Form view or Datasheet view. You must define the IsLoaded function in your database before you can use it. (You can copy and paste this function from Northwind into a utility module in your database.)
-------------------------------------
Option Compare Database
Option Explicit
Function IsLoaded(ByVal strFormName As String) As Boolean
' Returns True if the specified form is open in Form view or Datasheet view.
Dim oAccessObject As AccessObject
Set oAccessObject = CurrentProject.AllForms(strFormName)
If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView <> acCurViewDesign Then
IsLoaded = True
End If
End If
End Function
Have you got it working or not? If it is not working, please provide more details. Thanks.
Have you got it working or not? If it is not working, please provide more details. Thanks.
It works until I go to cancel in the form. The macro halts due to the original form that I used is looking for the data that was in the search form. Since it has closed, there is not data to search for.
It works until I go to cancel in the form. The macro halts due to the original form that I used is looking for the data that was in the search form. Since it has closed, there is not data to search for.
Try changing this:
Argument Setting
Form Name srchVariable
View Form
Data Mode Edit
Window Mode Dialog <----------------------------------
To this:
Argument Setting
Form Name srchVariable
View Form
Data Mode Edit
Window Mode Normal <----------------------------------
Opening the form in dialog mode suspends the execution of all other code until the user responds to the dialog prompt or closes the form.
It worked to get the "srchVariable" form to close without a error, however when opening original form, the srcVariable form is not out front now. The cancel button works for that form when I bring it to the front, but the original form hasn't closed yet. I ended up putting the following line in code for opening the original form rather that in the macro and it works great:
If Not IsLoaded("srchVariable") Then
...
Thank you for the help.
It worked to get the "srchVariable" form to close without a error, however when opening original form, the srcVariable form is not out front now. The cancel button works for that form when I bring it to the front, but the original form hasn't closed yet. I ended up putting the following line in code for opening the original form rather that in the macro and it works great:
If Not IsLoaded("srchVariable") Then
...
Thank you for the help.
You are most welcome. Glad I could help. Just so you know there are several ways that you could have solved your active screen problem. For example, you could have experimented and tweaked the popup and modal property settings of the two forms, with the bottom form set as Popup = No; modal = no and the form you wanted on the top could have been set Popup = yes and modal = ? maybe Yes. And there are other ways.....the way you chose is as good as any.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: CSDunn |
last post by:
Hello,
I have a problem with field filtering between an Access 2000 Project form
(the application is called CELDT), and the report that shows the results of
the filter. Both the form and the...
|
by: Afton |
last post by:
I would like to make a form that filters a report by Supervisor and by
starting and ending date.
I have the supervisors in a combo box, and that works.
However, I do not know how to code to let...
|
by: Glenn Zamora |
last post by:
I am new to MS Access. I have created a simple entry form to track
patient information. I have also created a Patient Report that prints
Patient Information with a standard disclaimer statement. I...
|
by: |
last post by:
hi,
i have a form on which a user can choose specific criteria such as dates
etc, in order to filter the report that is called from the form.
i do this by using the Where section of the...
|
by: Louly |
last post by:
Create a form to enter report criteria? Anyone can help me with this?
I don't want to do it using the Macros method. Is there a way to do it
using VBA?
Thanks for your cooperation.
Louly
|
by: fieldja |
last post by:
I have a form called OwnerForm. It contains a combo box called
Owner. The combo box looks up names from a table called OwnerName.
It contains fields called OwnerID and Owner. I also have a main...
|
by: Dave |
last post by:
On my form I have combo boxes. These combo boxes, after updating
them, populate respective listboxes that are located below the combo
boxes on the same form. I am trying to use a "generate...
|
by: eimbert |
last post by:
I have designed a report named report by Recruiter. I have made a form called frmRecruitmentReports, on this form I have created a pair of combo boxes .
1.Beggining Date (both are unbound)...
|
by: jgarcia187 |
last post by:
I have a report that runs based on parameters set in the underlying query. For example, in the "account number" field in the query I've entered in the criteria area. This allows the user to select...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |