From: Jack Leach dymondjack at hot mail dot on
And just for future reference, the Reports collection contains all *open*
reports... the AllReports collection contains all the reports in the db, open
or not. Same goes for Forms.

Might come in handy ;-)

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



"Sarah" wrote:

> thanks to Jack and Allen for some great answers.
> Sarah
>
> "Allen Browne" wrote:
>
> > Loop backwards (since you're reducing the count) through the Reports
> > collection:
> >
> > Dim i As Integer
> > For i = Reports.Count -1 To 0
> > If Reports(i).Name Like "rptGroup*" Then
> > DoCmd.Close acReport, Reports(i).Name
> > End If
> > Next
> >
> > --
> > Allen Browne - Microsoft MVP. Perth, Western Australia
> > Tips for Access users - http://allenbrowne.com/tips.html
> > Reply to group, rather than allenbrowne at mvps dot org.
> >
> >
> > "Sarah" <Sarah(a)discussions.microsoft.com> wrote in message
> > news:F701D373-D972-4612-ACA2-A77C135F80ED(a)microsoft.com...
> > > I have VBA where I need to close any reports that are currently open. All
> > > of
> > > the reports in question have names starting with "rptGroup" followed by 2
> > > more characters. There are up to 17 of these reports that could be open,
> > > so
> > > I use this coding to be sure I catch any open ones;
> > >
> > > DoCmd.Close acReport, "rptGroup01"
> > > DoCmd.Close acReport, "rptGroup02"
> > > DoCmd.Close acReport, "rptGroup03"
> > > ......
> > > DoCmd.Close acReport, "rptGroup17"
> > >
> > > is there a way to more simply close all reports LIKE "rptGroup*"?
> > >
> > > thanks in adavance
> > > Sarah
> >
> > .
> >
From: Jack Leach dymondjack at hot mail dot on
Well my first thought was "nope, not a fade... it's always been dim like that"

But on a serious note, did I miss something? I'm not seeing anything wrong
there...



"Stuart McCall" wrote:

> > If Left(rpt.Name) = "rptGroup" Then
>
> Tut tut Jack. Brain fade? <g>
>
>
> .
>
From: Douglas J. Steele on
"Jack Leach" <dymondjack at hot mail dot com> wrote in message
news:C3299979-D13D-4106-B26C-238AA74EB9FE(a)microsoft.com...
>
> But on a serious note, did I miss something? I'm not seeing anything
> wrong
> there...

The Left function requires a second argument to indicate how much of the
string to examine.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



From: Jack Leach dymondjack at hot mail dot on
I'm going to go hide in the corner now...


--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



"Douglas J. Steele" wrote:

> "Jack Leach" <dymondjack at hot mail dot com> wrote in message
> news:C3299979-D13D-4106-B26C-238AA74EB9FE(a)microsoft.com...
> >
> > But on a serious note, did I miss something? I'm not seeing anything
> > wrong
> > there...
>
> The Left function requires a second argument to indicate how much of the
> string to examine.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
>
> .
>
From: Stuart McCall on
"Jack Leach" <dymondjack at hot mail dot com> wrote in message
news:5F7F6B8F-EB71-489E-9373-D6F5AC04C33C(a)microsoft.com...
> I'm going to go hide in the corner now...

Lol. While you're there , remember that if you fall flat on your face you're
still moving forward.

I think it was the period in rpt.Name wot dun it. Your brain probably saw it
as a comma. Tricky things, brains. The following is a bit off-topic but it
illustrates the scenario perfectly:

Can you raed this? Olny 55 plepoe out of 100 can.

I cdnuolt blveiee that I cluod aulaclty uesdnatnrd what I was rdanieg.

The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at
Cmabrigde Uinervtisy, it dseno't mtaetr in what oerdr the ltteres in a word
are, the olny iproamtnt tihng is that the frsit and last ltteer be in the
rghit pclae.

The rset can be a taotl mses and you can still raed it whotuit a pboerlm.

This is bcuseae the huamn brian deos not raed ervey lteter by istlef, but
the
word as a wlohe.

Azanmig huh? Yaeh and I awlyas tghuhot slpeling was ipmorantt!