MS Office cant find object "DoCmd"

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
Access 2003 2
week day calculation question 1
DateDiff calculation 3
Combo box and report problem 0
Parameter Query 2

Top