MS Office cant find object "DoCmd"

T

TraciAnn

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

golfinray

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.
 
G

golfinray

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.
 
G

Gina Whipp

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

TraciAnn said:
golfinray,

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

Thanks for trying!
--
TraciAnn


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.
 
G

Gina Whipp

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

TraciAnn said:
golfinray,

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

Thanks for trying!
--
TraciAnn


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.
 
T

TraciAnn

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


Gina Whipp said:
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

TraciAnn said:
golfinray,

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

Thanks for trying!
--
TraciAnn


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.
:

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

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


Gina Whipp said:
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

TraciAnn said:
golfinray,

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

Thanks for trying!
--
TraciAnn


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.
:

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

I just realized you have this in the On_Open event of the report. Hold on
while I test that because all of mine are just the opposite. I open the
form THEN the report.

--
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:
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


Gina Whipp said:
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

TraciAnn said:
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

I just realized you have this in the On_Open event of the report. Hold on
while I test that because all of mine are just the opposite. I open the
form THEN the report.

--
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:
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


Gina Whipp said:
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

TraciAnn said:
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

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

TraciAnn said:
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


Gina Whipp said:
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

TraciAnn said:
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

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

TraciAnn said:
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


Gina Whipp said:
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

TraciAnn said:
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.
 
J

Jellifish

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.


TraciAnn said:
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


Gina Whipp said:
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

TraciAnn said:
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.
 
J

Jellifish

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.


TraciAnn said:
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


Gina Whipp said:
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

TraciAnn said:
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,

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

TraciAnn said:
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


Gina Whipp said:
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

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

TraciAnn said:
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

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


Jellifish said:
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.


TraciAnn said:
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


Gina Whipp said:
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

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



TraciAnn said:
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


Jellifish said:
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.


TraciAnn said:
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,

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

Clif McIrvin said:
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



TraciAnn said:
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


Jellifish said:
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

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

Clif McIrvin said:
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



TraciAnn said:
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.
 
G

Gina Whipp

Cliff,

I used what TraciAnn used DoCmd.OpenForm "frmDates", , , , , acDialog 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

Clif McIrvin said:
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.
 

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