473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

create a form to enter report criteria

27
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.
May 22 '07 #1
7 3425
puppydogbuddy
1,923 Expert 1GB
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.
May 23 '07 #2
Randoz
27
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
Jun 4 '07 #3
puppydogbuddy
1,923 Expert 1GB
Have you got it working or not? If it is not working, please provide more details. Thanks.
Jun 4 '07 #4
Randoz
27
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.
Jun 5 '07 #5
puppydogbuddy
1,923 Expert 1GB
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.
Jun 5 '07 #6
Randoz
27
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.
Jun 5 '07 #7
puppydogbuddy
1,923 Expert 1GB
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.
Jun 5 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
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...
3
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...
3
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...
8
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...
1
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
6
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...
6
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...
2
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)...
5
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...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
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...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.