MS Office cant find object "DoCmd"

L

liu

54656
golfinray said:
Go to tools\macro\visual basic editor and start the editor. Check
"references" under
tools and see if the box is checked for Visual Basic for Applications.
TraciAnn said:
I am trying to create a parameter form to run a report using these
instructions from a previous post:

When I run the report I get the error: Microsoft Office Access can't find
the object "DoCmd."

Is this a built in macro that was eliminated in the '07 release?

------
Create an unbound form.
Add a combo box.
Set the Row Source of the combo box to include the
CompanyID field and the Company Name.
Name the Combo Box 'FindCompany'.
Set it's Bound column to 1.
Set it's Column Count property to 2.
Set the Column Width property to 0";1"

Also add 2 unbound text controls.
Set their format to a valid date format.
Name them "StartDate" and "EndDate"

Add a Command Button to the form.
Code the button's click event:

Me.Visible = False

Name this form 'ParamForm'.

In the Query, (the Report's Record Source) [CompanyID] field criteria
line write:
forms!ParamForm!FindCompany

As criteria in the query date field write:
Between forms!Paramform!StartDate and forms!ParamForm!EndDate

Next, code the report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog

Code the report's Close event:
DoCmd.Close acForm, "ParamForm"

When ready to run the report, open the report.
The form will open and wait for the selection of the Company and the
entry of the starting and ending dates wanted.
Click the command button and then report will run.
When the report closes, it will close the form.

To display the date parameters in the report, add an unbound text
control to the Report Header.
Set it's control source to:
="For sales between " & [forms!Paramform!StartDate] & " and " &
[forms!ParamForm!EndDate]

The text, i.e. forms!Paramform!StartDate & forms!ParamForm!EndDate,
must be identical to the text in the query. Include the brackets as
shown.
 
C

Clif McIrvin

Gina,

From the property sheet the equal sign was required; and the Access
constants were not recognized.

From an [Event Procedure] the form TraciAnn posted DoCmd.OpenForm
"frmDates", , , , , acDialog works just fine (A2003).

--
Clif

Gina Whipp said:
Cliff,

I used what TraciAnn used Just changed the name of my form to
frmDates and it worked in Access 2007. It's interesting you got that
error. You're not using the equal sign correct?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II

http://www.regina-whipp.com/index_files/TipList.htm

Clif McIrvin said:
Thanks Gina.

Maybe I mis-understand what TraciAnn said.

At any rate, I just tried entering DoCmd directly into a report's
event property sheet (A2003) and it triggered a "Macro DoCmd not
Found" error.

If I enter

Open Event: =docmd.openform("Balloon Sample")
Close Event: =DoCmd.Close(acForm, "Balloon Sample", acSaveNo)

my form "Balloon Sample" opens, but when I close the report I get
something like "Automation Object acForm does not exist" for an error
message.

Changing the Close event to

=DoCmd.Close(2, "Balloon Sample", 2)

causes both the report and the form to close.

--
Clif

Gina Whipp said:
Clif,

I tested it the TraciAnn is using her DoCmd and it works so I'm
inclined to say she chan use it that way. The question becomes why
it works for me in Access 2007 and not for her.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II

http://www.regina-whipp.com/index_files/TipList.htm

I don't think DoCmd can be used that way ... it's a VBA object.

If you aren't ready to dive into learning VBA (nothing to be afraid
of ... but if it's all new you'll want to ease into it <g> ) you c
an try using a Macro.

Create a new Macro (I'm not familiar with 2007 .. so can't give you
the steps) and read up on the OpenForm Action.

After you have your Macro doing what you want, save it, and then
the macro name should be available to the property sheet.

The other option is to write VBA code as JelliFish suggests.

--
Clif



Hey JelliFish!

I'm a few lines shy of an application (if you know what I mean) ;)
So I need a little more instruction on how to "put the following
code into
your event".

I'm entering the DoCmd's by just entering them in their respective
fields of
the Property Sheet.

Sorry for the need of detail :/
Thanks for your help!!!
--
TraciAnn


:

Hello TraciAnn,

Can you put the following code into your event before the call to
DoCmd:

Dim db As DAO.Database

Set db = CurrentDb

MsgBox db.Name

And then run it. If it doesn't work then there is something
wrong with your
references, check them from the VBA window using Tools/References
and make
sure that the box for "Microsoft Access ##.# Object Library" is
checked
(where ##.# is your Access version).

If it is already checked, uncheck it, compact and repair your db
and then
open it up again and check this option again.

Let me know how you get on.


Sure!!

In the Report's On Open Event I put:
DoCmd.OpenForm "frmDates", , , , , acDialog

In the Report's On Close Event I put:
DoCmd.Close acForm, "frmDates"

Thanks Gina!
--
TraciAnn


:

TraciAnn,

Might help if you show the code that you are using because
DoCmd still
works
in Access.

--
Gina Whipp

"I feel I have been denied critical, need to know,
information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

message
golfinray,

Yes. Although it is Database Tools>>Macro>>Visual Basic in
'07, the VB
for
Applications box is checked.

Thanks for trying!
--
TraciAnn


:

Go to tools\macro\visual basic editor and start the editor.
Check
"references" under
tools and see if the box is checked for Visual Basic for
Applications.
:

I am trying to create a parameter form to run a report
using these
instructions from a previous post:

When I run the report I get the error: Microsoft Office
Access can't
find
the object "DoCmd."

Is this a built in macro that was eliminated in the '07
release?

------
Create an unbound form.
Add a combo box.
Set the Row Source of the combo box to include the
CompanyID field and the Company Name.
Name the Combo Box 'FindCompany'.
Set it's Bound column to 1.
Set it's Column Count property to 2.
Set the Column Width property to 0";1"

Also add 2 unbound text controls.
Set their format to a valid date format.
Name them "StartDate" and "EndDate"

Add a Command Button to the form.
Code the button's click event:

Me.Visible = False

Name this form 'ParamForm'.

In the Query, (the Report's Record Source) [CompanyID]
field
criteria
line write:
forms!ParamForm!FindCompany

As criteria in the query date field write:
Between forms!Paramform!StartDate and
forms!ParamForm!EndDate

Next, code the report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog

Code the report's Close event:
DoCmd.Close acForm, "ParamForm"

When ready to run the report, open the report.
The form will open and wait for the selection of the
Company and the
entry of the starting and ending dates wanted.
Click the command button and then report will run.
When the report closes, it will close the form.

To display the date parameters in the report, add an
unbound text
control to the Report Header.
Set it's control source to:
="For sales between " & [forms!Paramform!StartDate] & "
and " &
[forms!ParamForm!EndDate]

The text, i.e. forms!Paramform!StartDate &
forms!ParamForm!EndDate,
must be identical to the text in the query. Include the
brackets as
shown.
 
T

TraciAnn

Gina,

Moving DAO 3.6 to the highest possible position did not make a difference.

What is the simplest way to view the code behind a report? I clicked on
"View Code" and I get an empty VB window with two drop down fields. Inside
the left field is the name of each object in the report. Almost all objects
are very basic (see below). I'm not sure this is what you are looking for.

----------
Private Sub Label4_Click()

End Sub
----------

--
TraciAnn


Gina Whipp said:
TraciAnn,

Trying moving the DAO 3.6 reference up as far as it will go. I know it
sounds silly but sometimes the order of things has an impact. If that
doesn't work. I need you copy/paste all the code behind the report. Please
do not type it here, copy/paste it as the slightest thing can cause code to
do haywire, an extra space, an extra comma... that you may not be even
noticing.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

TraciAnn said:
Gina,

Assured 1 & 2.

In #3 I'm not positive what "form module section" is but with MS VB open
and
ANY of the objects above "utility" is selected ALL available references
are
the same.

The listed Available References (checked) are:
Visual Basic for Applications
MS Access 12.0 Object Library
OLE Automation
MS DAO 3.6 Object Library
MS VBA Extensibility 5.3

Thanks for your help!
--
TraciAnn


Gina Whipp said:
TraciAnn,

No problems so now let's check a few other things...

1. Check Trusted Locations and make sure the path to your file is there
2. Check Macro settings Access Options... Trust Center... Trust Center
Settings... Macro Settings... mine says Enable ALL macros.

3. If none of the above works then list all the References you have
under
Tools in the form module section.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Sure!!

In the Report's On Open Event I put:
DoCmd.OpenForm "frmDates", , , , , acDialog

In the Report's On Close Event I put:
DoCmd.Close acForm, "frmDates"

Thanks Gina!
--
TraciAnn


:

TraciAnn,

Might help if you show the code that you are using because DoCmd still
works
in Access.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

golfinray,

Yes. Although it is Database Tools>>Macro>>Visual Basic in '07, the
VB
for
Applications box is checked.

Thanks for trying!
--
TraciAnn


:

Go to tools\macro\visual basic editor and start the editor. Check
"references" under
tools and see if the box is checked for Visual Basic for
Applications.
:

I am trying to create a parameter form to run a report using
these
instructions from a previous post:

When I run the report I get the error: Microsoft Office Access
can't
find
the object "DoCmd."

Is this a built in macro that was eliminated in the '07 release?

------
Create an unbound form.
Add a combo box.
Set the Row Source of the combo box to include the
CompanyID field and the Company Name.
Name the Combo Box 'FindCompany'.
Set it's Bound column to 1.
Set it's Column Count property to 2.
Set the Column Width property to 0";1"

Also add 2 unbound text controls.
Set their format to a valid date format.
Name them "StartDate" and "EndDate"

Add a Command Button to the form.
Code the button's click event:

Me.Visible = False

Name this form 'ParamForm'.

In the Query, (the Report's Record Source) [CompanyID] field
criteria
line write:
forms!ParamForm!FindCompany

As criteria in the query date field write:
Between forms!Paramform!StartDate and forms!ParamForm!EndDate

Next, code the report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog

Code the report's Close event:
DoCmd.Close acForm, "ParamForm"

When ready to run the report, open the report.
The form will open and wait for the selection of the Company and
the
entry of the starting and ending dates wanted.
Click the command button and then report will run.
When the report closes, it will close the form.

To display the date parameters in the report, add an unbound text
control to the Report Header.
Set it's control source to:
="For sales between " & [forms!Paramform!StartDate] & " and " &
[forms!ParamForm!EndDate]

The text, i.e. forms!Paramform!StartDate &
forms!ParamForm!EndDate,
must be identical to the text in the query. Include the brackets
as
shown.
 
T

TraciAnn

IT'S WORKING!!!

Your questioning lead me to keep playing with it and here's what I did to
get it to work:

In Access '07 it is necessary to click in the Event field you wish to edit
and Click on the Build Button [...]. I was entering the DoCmd directly in the
property field.

After clicking on the Build Button you are prompted for 3 types of build
(Macro, Expression or Code). I selected "Code Builder" which took me to the
VB Editor in the Sub of that specific Event. Then I added the necessary code
and saved it.

The Event Property for both "On Open" and "On Close" both say "[Event
Procedure]" rather than the DoCmd I was typing directly into the fields.

It did create another problem, but I'm going to start a new thread since
this one is getting rather lengthy AND it can be considered separate.

Thanks everyone for your help and encouragement. I am starting to feel less
helpless and MORE empowered!!!! That wouldn't be possible without your
generosity and patience.

(Don't forget to look at my sequal post to this subject (3/18/09))

Thanks!
--
TraciAnn


Gina Whipp said:
TraciAnn,

Trying moving the DAO 3.6 reference up as far as it will go. I know it
sounds silly but sometimes the order of things has an impact. If that
doesn't work. I need you copy/paste all the code behind the report. Please
do not type it here, copy/paste it as the slightest thing can cause code to
do haywire, an extra space, an extra comma... that you may not be even
noticing.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

TraciAnn said:
Gina,

Assured 1 & 2.

In #3 I'm not positive what "form module section" is but with MS VB open
and
ANY of the objects above "utility" is selected ALL available references
are
the same.

The listed Available References (checked) are:
Visual Basic for Applications
MS Access 12.0 Object Library
OLE Automation
MS DAO 3.6 Object Library
MS VBA Extensibility 5.3

Thanks for your help!
--
TraciAnn


Gina Whipp said:
TraciAnn,

No problems so now let's check a few other things...

1. Check Trusted Locations and make sure the path to your file is there
2. Check Macro settings Access Options... Trust Center... Trust Center
Settings... Macro Settings... mine says Enable ALL macros.

3. If none of the above works then list all the References you have
under
Tools in the form module section.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Sure!!

In the Report's On Open Event I put:
DoCmd.OpenForm "frmDates", , , , , acDialog

In the Report's On Close Event I put:
DoCmd.Close acForm, "frmDates"

Thanks Gina!
--
TraciAnn


:

TraciAnn,

Might help if you show the code that you are using because DoCmd still
works
in Access.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

golfinray,

Yes. Although it is Database Tools>>Macro>>Visual Basic in '07, the
VB
for
Applications box is checked.

Thanks for trying!
--
TraciAnn


:

Go to tools\macro\visual basic editor and start the editor. Check
"references" under
tools and see if the box is checked for Visual Basic for
Applications.
:

I am trying to create a parameter form to run a report using
these
instructions from a previous post:

When I run the report I get the error: Microsoft Office Access
can't
find
the object "DoCmd."

Is this a built in macro that was eliminated in the '07 release?

------
Create an unbound form.
Add a combo box.
Set the Row Source of the combo box to include the
CompanyID field and the Company Name.
Name the Combo Box 'FindCompany'.
Set it's Bound column to 1.
Set it's Column Count property to 2.
Set the Column Width property to 0";1"

Also add 2 unbound text controls.
Set their format to a valid date format.
Name them "StartDate" and "EndDate"

Add a Command Button to the form.
Code the button's click event:

Me.Visible = False

Name this form 'ParamForm'.

In the Query, (the Report's Record Source) [CompanyID] field
criteria
line write:
forms!ParamForm!FindCompany

As criteria in the query date field write:
Between forms!Paramform!StartDate and forms!ParamForm!EndDate

Next, code the report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog

Code the report's Close event:
DoCmd.Close acForm, "ParamForm"

When ready to run the report, open the report.
The form will open and wait for the selection of the Company and
the
entry of the starting and ending dates wanted.
Click the command button and then report will run.
When the report closes, it will close the form.

To display the date parameters in the report, add an unbound text
control to the Report Header.
Set it's control source to:
="For sales between " & [forms!Paramform!StartDate] & " and " &
[forms!ParamForm!EndDate]

The text, i.e. forms!Paramform!StartDate &
forms!ParamForm!EndDate,
must be identical to the text in the query. Include the brackets
as
shown.
 
C

Clif McIrvin

Wonderful!

TraciAnn said:
IT'S WORKING!!!

Your questioning lead me to keep playing with it and here's what I did
to
get it to work:

In Access '07 it is necessary to click in the Event field you wish to
edit
and Click on the Build Button [...]. I was entering the DoCmd directly
in the
property field.

After clicking on the Build Button you are prompted for 3 types of
build
(Macro, Expression or Code). I selected "Code Builder" which took me
to the
VB Editor in the Sub of that specific Event. Then I added the
necessary code
and saved it.

The Event Property for both "On Open" and "On Close" both say "[Event
Procedure]" rather than the DoCmd I was typing directly into the
fields.

It did create another problem, but I'm going to start a new thread
since
this one is getting rather lengthy AND it can be considered separate.

Thanks everyone for your help and encouragement. I am starting to feel
less
helpless and MORE empowered!!!! That wouldn't be possible without your
generosity and patience.

(Don't forget to look at my sequal post to this subject (3/18/09))

Thanks!
 
G

Gina Whipp

YIPPPPEEEEEE!

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

TraciAnn said:
IT'S WORKING!!!

Your questioning lead me to keep playing with it and here's what I did to
get it to work:

In Access '07 it is necessary to click in the Event field you wish to edit
and Click on the Build Button [...]. I was entering the DoCmd directly in
the
property field.

After clicking on the Build Button you are prompted for 3 types of build
(Macro, Expression or Code). I selected "Code Builder" which took me to
the
VB Editor in the Sub of that specific Event. Then I added the necessary
code
and saved it.

The Event Property for both "On Open" and "On Close" both say "[Event
Procedure]" rather than the DoCmd I was typing directly into the fields.

It did create another problem, but I'm going to start a new thread since
this one is getting rather lengthy AND it can be considered separate.

Thanks everyone for your help and encouragement. I am starting to feel
less
helpless and MORE empowered!!!! That wouldn't be possible without your
generosity and patience.

(Don't forget to look at my sequal post to this subject (3/18/09))

Thanks!
--
TraciAnn


Gina Whipp said:
TraciAnn,

Trying moving the DAO 3.6 reference up as far as it will go. I know it
sounds silly but sometimes the order of things has an impact. If that
doesn't work. I need you copy/paste all the code behind the report.
Please
do not type it here, copy/paste it as the slightest thing can cause code
to
do haywire, an extra space, an extra comma... that you may not be even
noticing.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

TraciAnn said:
Gina,

Assured 1 & 2.

In #3 I'm not positive what "form module section" is but with MS VB
open
and
ANY of the objects above "utility" is selected ALL available references
are
the same.

The listed Available References (checked) are:
Visual Basic for Applications
MS Access 12.0 Object Library
OLE Automation
MS DAO 3.6 Object Library
MS VBA Extensibility 5.3

Thanks for your help!
--
TraciAnn


:

TraciAnn,

No problems so now let's check a few other things...

1. Check Trusted Locations and make sure the path to your file is
there
2. Check Macro settings Access Options... Trust Center... Trust
Center
Settings... Macro Settings... mine says Enable ALL macros.

3. If none of the above works then list all the References you have
under
Tools in the form module section.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Sure!!

In the Report's On Open Event I put:
DoCmd.OpenForm "frmDates", , , , , acDialog

In the Report's On Close Event I put:
DoCmd.Close acForm, "frmDates"

Thanks Gina!
--
TraciAnn


:

TraciAnn,

Might help if you show the code that you are using because DoCmd
still
works
in Access.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

golfinray,

Yes. Although it is Database Tools>>Macro>>Visual Basic in '07,
the
VB
for
Applications box is checked.

Thanks for trying!
--
TraciAnn


:

Go to tools\macro\visual basic editor and start the editor.
Check
"references" under
tools and see if the box is checked for Visual Basic for
Applications.
:

I am trying to create a parameter form to run a report using
these
instructions from a previous post:

When I run the report I get the error: Microsoft Office Access
can't
find
the object "DoCmd."

Is this a built in macro that was eliminated in the '07
release?

------
Create an unbound form.
Add a combo box.
Set the Row Source of the combo box to include the
CompanyID field and the Company Name.
Name the Combo Box 'FindCompany'.
Set it's Bound column to 1.
Set it's Column Count property to 2.
Set the Column Width property to 0";1"

Also add 2 unbound text controls.
Set their format to a valid date format.
Name them "StartDate" and "EndDate"

Add a Command Button to the form.
Code the button's click event:

Me.Visible = False

Name this form 'ParamForm'.

In the Query, (the Report's Record Source) [CompanyID] field
criteria
line write:
forms!ParamForm!FindCompany

As criteria in the query date field write:
Between forms!Paramform!StartDate and forms!ParamForm!EndDate

Next, code the report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog

Code the report's Close event:
DoCmd.Close acForm, "ParamForm"

When ready to run the report, open the report.
The form will open and wait for the selection of the Company
and
the
entry of the starting and ending dates wanted.
Click the command button and then report will run.
When the report closes, it will close the form.

To display the date parameters in the report, add an unbound
text
control to the Report Header.
Set it's control source to:
="For sales between " & [forms!Paramform!StartDate] & " and "
&
[forms!ParamForm!EndDate]

The text, i.e. forms!Paramform!StartDate &
forms!ParamForm!EndDate,
must be identical to the text in the query. Include the
brackets
as
shown.
 
G

Gina Whipp

Clif,

You are correct and I wasn't paying attention...

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Clif McIrvin said:
Gina,

From the property sheet the equal sign was required; and the Access
constants were not recognized.

From an [Event Procedure] the form TraciAnn posted DoCmd.OpenForm
"frmDates", , , , , acDialog works just fine (A2003).

--
Clif

Gina Whipp said:
Cliff,

I used what TraciAnn used Just changed the name of my form to frmDates
and it worked in Access 2007. It's interesting you got that error.
You're not using the equal sign correct?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II

http://www.regina-whipp.com/index_files/TipList.htm

Clif McIrvin said:
Thanks Gina.

Maybe I mis-understand what TraciAnn said.

At any rate, I just tried entering DoCmd directly into a report's event
property sheet (A2003) and it triggered a "Macro DoCmd not Found" error.

If I enter

Open Event: =docmd.openform("Balloon Sample")
Close Event: =DoCmd.Close(acForm, "Balloon Sample", acSaveNo)

my form "Balloon Sample" opens, but when I close the report I get
something like "Automation Object acForm does not exist" for an error
message.

Changing the Close event to

=DoCmd.Close(2, "Balloon Sample", 2)

causes both the report and the form to close.

--
Clif

Clif,

I tested it the TraciAnn is using her DoCmd and it works so I'm
inclined to say she chan use it that way. The question becomes why it
works for me in Access 2007 and not for her.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II

http://www.regina-whipp.com/index_files/TipList.htm

I don't think DoCmd can be used that way ... it's a VBA object.

If you aren't ready to dive into learning VBA (nothing to be afraid of
... but if it's all new you'll want to ease into it <g> ) you c an try
using a Macro.

Create a new Macro (I'm not familiar with 2007 .. so can't give you
the steps) and read up on the OpenForm Action.

After you have your Macro doing what you want, save it, and then the
macro name should be available to the property sheet.

The other option is to write VBA code as JelliFish suggests.

--
Clif



Hey JelliFish!

I'm a few lines shy of an application (if you know what I mean) ;)
So I need a little more instruction on how to "put the following code
into
your event".

I'm entering the DoCmd's by just entering them in their respective
fields of
the Property Sheet.

Sorry for the need of detail :/
Thanks for your help!!!
--
TraciAnn


:

Hello TraciAnn,

Can you put the following code into your event before the call to
DoCmd:

Dim db As DAO.Database

Set db = CurrentDb

MsgBox db.Name

And then run it. If it doesn't work then there is something wrong
with your
references, check them from the VBA window using Tools/References
and make
sure that the box for "Microsoft Access ##.# Object Library" is
checked
(where ##.# is your Access version).

If it is already checked, uncheck it, compact and repair your db and
then
open it up again and check this option again.

Let me know how you get on.


Sure!!

In the Report's On Open Event I put:
DoCmd.OpenForm "frmDates", , , , , acDialog

In the Report's On Close Event I put:
DoCmd.Close acForm, "frmDates"

Thanks Gina!
--
TraciAnn


:

TraciAnn,

Might help if you show the code that you are using because DoCmd
still
works
in Access.

--
Gina Whipp

"I feel I have been denied critical, need to know,
information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

golfinray,

Yes. Although it is Database Tools>>Macro>>Visual Basic in '07,
the VB
for
Applications box is checked.

Thanks for trying!
--
TraciAnn


:

Go to tools\macro\visual basic editor and start the editor.
Check
"references" under
tools and see if the box is checked for Visual Basic for
Applications.
:

I am trying to create a parameter form to run a report using
these
instructions from a previous post:

When I run the report I get the error: Microsoft Office
Access can't
find
the object "DoCmd."

Is this a built in macro that was eliminated in the '07
release?

------
Create an unbound form.
Add a combo box.
Set the Row Source of the combo box to include the
CompanyID field and the Company Name.
Name the Combo Box 'FindCompany'.
Set it's Bound column to 1.
Set it's Column Count property to 2.
Set the Column Width property to 0";1"

Also add 2 unbound text controls.
Set their format to a valid date format.
Name them "StartDate" and "EndDate"

Add a Command Button to the form.
Code the button's click event:

Me.Visible = False

Name this form 'ParamForm'.

In the Query, (the Report's Record Source) [CompanyID] field
criteria
line write:
forms!ParamForm!FindCompany

As criteria in the query date field write:
Between forms!Paramform!StartDate and
forms!ParamForm!EndDate

Next, code the report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog

Code the report's Close event:
DoCmd.Close acForm, "ParamForm"

When ready to run the report, open the report.
The form will open and wait for the selection of the Company
and the
entry of the starting and ending dates wanted.
Click the command button and then report will run.
When the report closes, it will close the form.

To display the date parameters in the report, add an unbound
text
control to the Report Header.
Set it's control source to:
="For sales between " & [forms!Paramform!StartDate] & " and
" &
[forms!ParamForm!EndDate]

The text, i.e. forms!Paramform!StartDate &
forms!ParamForm!EndDate,
must be identical to the text in the query. Include the
brackets as
shown.
 
C

Clif McIrvin

Gina Whipp said:
Clif,

You are correct and I wasn't paying attention...

Thanks, Gina.

Happens to all of us sooner or later, I fear :)

Not paying attention bit me earlier today in another thread.
 

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

Similar Threads

Combo Box on Report 10
Nz function not showing all records 2
Using A form to input criteria 4
Combo box Plus Select all Option 1
Parameter Query 2
List Box MultiSelect 9
Missing something 6
Sum Query 1

Top