macro events

G

Guest

Hi,

I have created a macro which seems to be working, but there are a few
problems. I want the macro to check if certain conditions exist and if they
exist , then I want a dialog box to pop up. The user has the option of
entering information into this dialog box. Upon closing the dialog box a
report is generated. If the conditions do not exist, then I do not want the
dialog box to pop up, and I want the report to run (this works). The
problem that I am having is that when the conditions exist the dialog box
pops up, but the report is being run before the dialog box is filled in (i.e.
it opens on top of the dialog box). In this case I don't really want to run
the report from this macro, I want the report to be run when the user clicks
OK on the dialog box.

The code for the macro is as follows:

Open Query (runs an update query to mark a field)
Open Form (opens a form in hidden view , so that I can check
criteria--probably a better way but I don't know it)
[forms]![NameOfForm]!"FieldName"="1" or "2" or "3" Open Form (this is the
dialog box)
Open Report

Thanks for any suggestions
 
S

Steve Schapel

Karen,

Can you explain the meaning of the Criteria? Do you really have a form
named NameOfForm?

You could put a StopMacro action, with an ellipsis (...) in the
Condition column, after the action that opens the dialog form. Then
make a separate macro to print the report, to go on the OK buttin on the
dialog form. I think that would work, based on what you have told us so
far.
 
G

Guest

OK, I'll try the ellipsis. The criteria was to check to see if the value of
a record in a field was equal to a specific value. If it was, then I did not
want to print out a particular field in that record in order to conserve
paper.

Steve Schapel said:
Karen,

Can you explain the meaning of the Criteria? Do you really have a form
named NameOfForm?

You could put a StopMacro action, with an ellipsis (...) in the
Condition column, after the action that opens the dialog form. Then
make a separate macro to print the report, to go on the OK buttin on the
dialog form. I think that would work, based on what you have told us so
far.

--
Steve Schapel, Microsoft Access MVP
Hi,

I have created a macro which seems to be working, but there are a few
problems. I want the macro to check if certain conditions exist and if they
exist , then I want a dialog box to pop up. The user has the option of
entering information into this dialog box. Upon closing the dialog box a
report is generated. If the conditions do not exist, then I do not want the
dialog box to pop up, and I want the report to run (this works). The
problem that I am having is that when the conditions exist the dialog box
pops up, but the report is being run before the dialog box is filled in (i.e.
it opens on top of the dialog box). In this case I don't really want to run
the report from this macro, I want the report to be run when the user clicks
OK on the dialog box.

The code for the macro is as follows:

Open Query (runs an update query to mark a field)
Open Form (opens a form in hidden view , so that I can check
criteria--probably a better way but I don't know it)
[forms]![NameOfForm]!"FieldName"="1" or "2" or "3" Open Form (this is the
dialog box)
Open Report

Thanks for any suggestions
 
G

Guest

The macro is ignoring my condition. In the condition column I have it set at
[forms]![frmQuestionWording]![DoNotPrintBrand]=-1. If any record in the
DoNotPrintBrand field is -1, then I would like to open a diaog box. In the
subsequent line of the macro, I have an ellipsis in the condition column
followed by StopMacro. If the condition above is not met, I would simply
like to open the report. Right now the report is opening, but the dialog box
is not popping up although the condition is being met. (DoNotPrintBrand is
a checkbox)

Thanks for any suggestions.



Karen said:
OK, I'll try the ellipsis. The criteria was to check to see if the value of
a record in a field was equal to a specific value. If it was, then I did not
want to print out a particular field in that record in order to conserve
paper.

Steve Schapel said:
Karen,

Can you explain the meaning of the Criteria? Do you really have a form
named NameOfForm?

You could put a StopMacro action, with an ellipsis (...) in the
Condition column, after the action that opens the dialog form. Then
make a separate macro to print the report, to go on the OK buttin on the
dialog form. I think that would work, based on what you have told us so
far.

--
Steve Schapel, Microsoft Access MVP
Hi,

I have created a macro which seems to be working, but there are a few
problems. I want the macro to check if certain conditions exist and if they
exist , then I want a dialog box to pop up. The user has the option of
entering information into this dialog box. Upon closing the dialog box a
report is generated. If the conditions do not exist, then I do not want the
dialog box to pop up, and I want the report to run (this works). The
problem that I am having is that when the conditions exist the dialog box
pops up, but the report is being run before the dialog box is filled in (i.e.
it opens on top of the dialog box). In this case I don't really want to run
the report from this macro, I want the report to be run when the user clicks
OK on the dialog box.

The code for the macro is as follows:

Open Query (runs an update query to mark a field)
Open Form (opens a form in hidden view , so that I can check
criteria--probably a better way but I don't know it)
[forms]![NameOfForm]!"FieldName"="1" or "2" or "3" Open Form (this is the
dialog box)
Open Report

Thanks for any suggestions
 
S

Steve Schapel

Karen,

Using a Condition like this...
[Forms]![frmQuestionWording]![DoNotPrintBrand]=-1
.... assumes that the frmQuestionWording form is open at the time, and
the condition will then evaluate the DoNotPrintBrand field in the
*current record* of the form.

If you want "any record", you will need a Domain function. Either of
these should work...
DCount("*","YourTable","[DoNotPrintBrand]=-1")>0
DSum("[DoNotPrintBrand]","YourTable")<0
 
G

Guest

Thanks, that works perfectly.

Steve Schapel said:
Karen,

Using a Condition like this...
[Forms]![frmQuestionWording]![DoNotPrintBrand]=-1
.... assumes that the frmQuestionWording form is open at the time, and
the condition will then evaluate the DoNotPrintBrand field in the
*current record* of the form.

If you want "any record", you will need a Domain function. Either of
these should work...
DCount("*","YourTable","[DoNotPrintBrand]=-1")>0
DSum("[DoNotPrintBrand]","YourTable")<0

--
Steve Schapel, Microsoft Access MVP

The macro is ignoring my condition. In the condition column I have it set at
[forms]![frmQuestionWording]![DoNotPrintBrand]=-1. If any record in the
DoNotPrintBrand field is -1, then I would like to open a diaog box. In the
subsequent line of the macro, I have an ellipsis in the condition column
followed by StopMacro. If the condition above is not met, I would simply
like to open the report. Right now the report is opening, but the dialog box
is not popping up although the condition is being met. (DoNotPrintBrand is
a checkbox)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top