Error in code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following code supplied to me by Dirk Goldgar.

With cnt
For intDocX = .Documents.Count - 1 To 0 Step -1
appAccess.DoCmd.DeleteObject iObjectType, Documents(intDocX).Name
Next intDocX
End With

It won't compile. I am getting an error on the third line.

Documents(intDocX).name

The word Documents is highlighted and it says sub not defined. Does anybody
know the reason?
 
The probably reason why yuur code is not compiling and giving you such error
message should be because there is a missed function called Documents which
you don't have in your code. Check with your code provider for that function.
 
SHIPP said:
Nope that didn't work.

You had no dot; Alex posted it with two dots (obviously accidentally).
The code I actually posted had one dot:

appAccess.DoCmd.DeleteObject iObjectType, .Documents(intDocX).Name

And I assure you it works in my tests.
 
Hi Dirk,
hmm, can't understand where from second dot came, i posted only one:

"try to add a dot:
..Documents(intDocX).name"
 
It worked great. Thanks a lot for all your help.

Dirk Goldgar said:
You had no dot; Alex posted it with two dots (obviously accidentally).
The code I actually posted had one dot:

appAccess.DoCmd.DeleteObject iObjectType, .Documents(intDocX).Name

And I assure you it works in my tests.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Alex Dybenko said:
Hi Dirk,
hmm, can't understand where from second dot came, i posted only one:

"try to add a dot:
.Documents(intDocX).name"

Hmm, I see that you're right. But your quoted text in SHIPP's message
has an extra dot. How odd.
 
Back
Top