A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Create "cancel" button on a form collecting parameters



 
 
Thread Tools Display Modes
  #1  
Old July 23rd, 2009, 05:49 AM posted to microsoft.public.access.gettingstarted
anders bitzer
external usenet poster
 
Posts: 2
Default Create "cancel" button on a form collecting parameters

Hi
As new danish user in Access 2007 I have a small question.
With help from the help menu, I have created a form that collects parameters
for a report. Only thing missing is a cancel button on the form that allows
me to cancel the query.
Following the help menu I have following module in VBA, but I guess
something should be changed between the brackets.

Function IsLoaded(ByVal strFormName As String) As Boolean

Dim oAccessObject As AccessObject
Set oAccessObject = CurrentProject.AllForms(strFormName)

If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView acCurViewDesign Then
IsLoaded = True
End If
End If

Thanks in advance for any help.
Anders
Ads
  #2  
Old July 23rd, 2009, 08:00 AM posted to microsoft.public.access.gettingstarted
NevilleT
external usenet poster
 
Posts: 159
Default Create "cancel" button on a form collecting parameters

Hi Anders
Not sure how you are approaching this, but the usual way is to have a report
button on a form. The report button opens the parameter form, and you fill
in details. You then have a button on the parameter form called something
like "Preview Report" which opens the report. If you close the parameter
form, you never get to the report. If you want you can add a "Cancel" button
to the parameter form which closes the form.

Neville Turbit
www.projectperfect.com.au


"anders bitzer" wrote:

Hi
As new danish user in Access 2007 I have a small question.
With help from the help menu, I have created a form that collects parameters
for a report. Only thing missing is a cancel button on the form that allows
me to cancel the query.
Following the help menu I have following module in VBA, but I guess
something should be changed between the brackets.

Function IsLoaded(ByVal strFormName As String) As Boolean

Dim oAccessObject As AccessObject
Set oAccessObject = CurrentProject.AllForms(strFormName)

If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView acCurViewDesign Then
IsLoaded = True
End If
End If

Thanks in advance for any help.
Anders

  #3  
Old July 23rd, 2009, 08:12 AM posted to microsoft.public.access.gettingstarted
anders bitzer
external usenet poster
 
Posts: 2
Default Create "cancel" button on a form collecting parameters

Hi Neville
Thanks for answer.
I have a report and when starting this report a macro runs and opens the
form on which I give the parameters. Therefore the cancel button must stop
this macro if anyone clicks it. Anyway I will try to make in the way that you
suggest.
Thanks
Anders

"NevilleT" skrev:

Hi Anders
Not sure how you are approaching this, but the usual way is to have a report
button on a form. The report button opens the parameter form, and you fill
in details. You then have a button on the parameter form called something
like "Preview Report" which opens the report. If you close the parameter
form, you never get to the report. If you want you can add a "Cancel" button
to the parameter form which closes the form.

Neville Turbit
www.projectperfect.com.au


"anders bitzer" wrote:

Hi
As new danish user in Access 2007 I have a small question.
With help from the help menu, I have created a form that collects parameters
for a report. Only thing missing is a cancel button on the form that allows
me to cancel the query.
Following the help menu I have following module in VBA, but I guess
something should be changed between the brackets.

Function IsLoaded(ByVal strFormName As String) As Boolean

Dim oAccessObject As AccessObject
Set oAccessObject = CurrentProject.AllForms(strFormName)

If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView acCurViewDesign Then
IsLoaded = True
End If
End If

Thanks in advance for any help.
Anders

  #4  
Old July 23rd, 2009, 08:42 AM posted to microsoft.public.access.gettingstarted
NevilleT
external usenet poster
 
Posts: 159
Default Create "cancel" button on a form collecting parameters

One more point. Make sure you open the report before you close the form. If
you close the form first, the query will not run properly as the parameters
will be missing. You can also use the code to check the fields have been
entered before the report runs. If you are having difficulty, post a
response to this and I will see if I can help.

Neville Turbit
www.projectperfect.com.au

"anders bitzer" wrote:

Hi Neville
Thanks for answer.
I have a report and when starting this report a macro runs and opens the
form on which I give the parameters. Therefore the cancel button must stop
this macro if anyone clicks it. Anyway I will try to make in the way that you
suggest.
Thanks
Anders

"NevilleT" skrev:

Hi Anders
Not sure how you are approaching this, but the usual way is to have a report
button on a form. The report button opens the parameter form, and you fill
in details. You then have a button on the parameter form called something
like "Preview Report" which opens the report. If you close the parameter
form, you never get to the report. If you want you can add a "Cancel" button
to the parameter form which closes the form.

Neville Turbit
www.projectperfect.com.au


"anders bitzer" wrote:

Hi
As new danish user in Access 2007 I have a small question.
With help from the help menu, I have created a form that collects parameters
for a report. Only thing missing is a cancel button on the form that allows
me to cancel the query.
Following the help menu I have following module in VBA, but I guess
something should be changed between the brackets.

Function IsLoaded(ByVal strFormName As String) As Boolean

Dim oAccessObject As AccessObject
Set oAccessObject = CurrentProject.AllForms(strFormName)

If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView acCurViewDesign Then
IsLoaded = True
End If
End If

Thanks in advance for any help.
Anders

  #5  
Old July 23rd, 2009, 03:07 PM posted to microsoft.public.access.gettingstarted
Klatuu
external usenet poster
 
Posts: 7,074
Default Create "cancel" button on a form collecting parameters

I suggest you break your Macro into two pieces.
The first should do all the things to open the form.
Then use the rest of the macro to do what you are doing now when you want to
run the report. In the Click event of the Cancel button, close the form.
--
Dave Hargis, Microsoft Access MVP


"anders bitzer" wrote:

Hi Neville
Thanks for answer.
I have a report and when starting this report a macro runs and opens the
form on which I give the parameters. Therefore the cancel button must stop
this macro if anyone clicks it. Anyway I will try to make in the way that you
suggest.
Thanks
Anders

"NevilleT" skrev:

Hi Anders
Not sure how you are approaching this, but the usual way is to have a report
button on a form. The report button opens the parameter form, and you fill
in details. You then have a button on the parameter form called something
like "Preview Report" which opens the report. If you close the parameter
form, you never get to the report. If you want you can add a "Cancel" button
to the parameter form which closes the form.

Neville Turbit
www.projectperfect.com.au


"anders bitzer" wrote:

Hi
As new danish user in Access 2007 I have a small question.
With help from the help menu, I have created a form that collects parameters
for a report. Only thing missing is a cancel button on the form that allows
me to cancel the query.
Following the help menu I have following module in VBA, but I guess
something should be changed between the brackets.

Function IsLoaded(ByVal strFormName As String) As Boolean

Dim oAccessObject As AccessObject
Set oAccessObject = CurrentProject.AllForms(strFormName)

If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView acCurViewDesign Then
IsLoaded = True
End If
End If

Thanks in advance for any help.
Anders

  #6  
Old June 4th, 2010, 12:33 PM posted to microsoft.public.access.gettingstarted
kalai
external usenet poster
 
Posts: 6
Default Create "cancel" button on a form collecting parameters

hi anders,
Is that help working for you. the macro is not working for me
i reffered this link
http://office.microsoft.com/en-us/ac...spx#form_param

hope u too reffered the same.. can u help me out..
i need a form that will help to query and display results based on the
parameters entered..

thank you.
Kalai

--
Kalai


"Klatuu" wrote:

I suggest you break your Macro into two pieces.
The first should do all the things to open the form.
Then use the rest of the macro to do what you are doing now when you want to
run the report. In the Click event of the Cancel button, close the form.
--
Dave Hargis, Microsoft Access MVP


"anders bitzer" wrote:

Hi Neville
Thanks for answer.
I have a report and when starting this report a macro runs and opens the
form on which I give the parameters. Therefore the cancel button must stop
this macro if anyone clicks it. Anyway I will try to make in the way that you
suggest.
Thanks
Anders

"NevilleT" skrev:

Hi Anders
Not sure how you are approaching this, but the usual way is to have a report
button on a form. The report button opens the parameter form, and you fill
in details. You then have a button on the parameter form called something
like "Preview Report" which opens the report. If you close the parameter
form, you never get to the report. If you want you can add a "Cancel" button
to the parameter form which closes the form.

Neville Turbit
www.projectperfect.com.au


"anders bitzer" wrote:

Hi
As new danish user in Access 2007 I have a small question.
With help from the help menu, I have created a form that collects parameters
for a report. Only thing missing is a cancel button on the form that allows
me to cancel the query.
Following the help menu I have following module in VBA, but I guess
something should be changed between the brackets.

Function IsLoaded(ByVal strFormName As String) As Boolean

Dim oAccessObject As AccessObject
Set oAccessObject = CurrentProject.AllForms(strFormName)

If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView acCurViewDesign Then
IsLoaded = True
End If
End If

Thanks in advance for any help.
Anders

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:25 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright 2004-2017 OfficeFrustration.
The comments are property of their posters.