WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

Case statement Problem

 
Goto page 1, 2, 3, 4
   Home -> Office other -> General Discussions RSS
Next:  General Discussions: List box Full warning!  
Author Message
tony Jacobs

External


Since: Jul 03, 2008
Posts: 14



(Msg. 1) Posted: Thu Jul 03, 2008 11:15 pm
Post subject: Case statement Problem Add to elertz
Archived from groups: microsoft>public>access, others (more info?)

I am having trouble with this code can anyone help.

I have the follwing case statement that checks the value of the combo box,
and based on that it will select which report to print, but I can not get it
to work

Select Case ReportPrint

Case "Me![Combo28].column(1) = Like'B*'"
stDocName = "Productsreport1"

Case "Me![Combo28].column(1) = 'Like'C*''"

stDocName = "Productsreport2"

Case Else

stDocName = "Productsreport"

End Select
DoCmd.OpenReport stDocName, acViewPreview, , "ProductID IN " &
strSelected


Thanks in advance
Back to top
Login to vote
strive4peace

External


Since: Apr 04, 2006
Posts: 939



(Msg. 2) Posted: Thu Jul 03, 2008 11:17 pm
Post subject: Re: Case statement Problem Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

hi Tony

"Me![Combo28].column(1) = Like'B*'"
--> left(Me![Combo28].column(1),1) = "B"

"Me![Combo28].column(1) = 'Like'C*''"
--> left(Me![Combo28].column(1),1) = "C"


Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
(: have an awesome day Smile
*




tony Jacobs wrote:
> I am having trouble with this code can anyone help.
>
> I have the follwing case statement that checks the value of the combo box,
> and based on that it will select which report to print, but I can not get it
> to work
>
> Select Case ReportPrint
>
> Case "Me![Combo28].column(1) = Like'B*'"
> stDocName = "Productsreport1"
>
> Case "Me![Combo28].column(1) = 'Like'C*''"
>
> stDocName = "Productsreport2"
>
> Case Else
>
> stDocName = "Productsreport"
>
> End Select
> DoCmd.OpenReport stDocName, acViewPreview, , "ProductID IN " &
> strSelected
>
>
> Thanks in advance
>
>
Back to top
Login to vote
John Spencer

External


Since: Jan 21, 2007
Posts: 306



(Msg. 3) Posted: Fri Jul 04, 2008 9:56 am
Post subject: Re: Case statement Problem Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Select Case Left(Me.Combo28 & "",1)

Case "B"
stDocName = "Productsreport1"

Case "C"

stDocName = "Productsreport2"

Case Else

stDocName = "Productsreport"

End Select

DoCmd.OpenReport stDocName, acViewPreview, , "ProductID IN " &
strSelected


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================


strive4peace wrote:
> hi Tony
>
> "Me![Combo28].column(1) = Like'B*'"
> --> left(Me![Combo28].column(1),1) = "B"
>
> "Me![Combo28].column(1) = 'Like'C*''"
> --> left(Me![Combo28].column(1),1) = "C"
>
>
> Warm Regards,
> Crystal
>
> remote programming and training
>
> Access Basics
> 8-part free tutorial that covers essentials in Access
> http://www.AccessMVP.com/strive4peace
>
> *
> (: have an awesome day Smile
> *
>
>
>
>
> tony Jacobs wrote:
>> I am having trouble with this code can anyone help.
>>
>> I have the follwing case statement that checks the value of the combo
>> box,
>> and based on that it will select which report to print, but I can not
>> get it
>> to work
>>
>> Select Case ReportPrint
>>
>> Case "Me![Combo28].column(1) = Like'B*'"
>> stDocName = "Productsreport1"
>>
>> Case "Me![Combo28].column(1) = 'Like'C*''"
>>
>> stDocName = "Productsreport2"
>>
>> Case Else
>>
>> stDocName = "Productsreport"
>>
>> End Select
>> DoCmd.OpenReport stDocName, acViewPreview, , "ProductID IN " &
>> strSelected
>>
>>
>> Thanks in advance
>>
>>
Back to top
Login to vote
tony Jacobs

External


Since: Jul 03, 2008
Posts: 14



(Msg. 4) Posted: Fri Jul 04, 2008 10:34 am
Post subject: Re: Case statement Problem Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Sorry John; I did not work ! Any other ideas?


"John Spencer" <spencer.DeleteThis@chpdm.umbc> wrote in message
news:uB2eF3d3IHA.4272@TK2MSFTNGP03.phx.gbl...
> Select Case Left(Me.Combo28 & "",1)
>
> Case "B"
> stDocName = "Productsreport1"
>
> Case "C"
>
> stDocName = "Productsreport2"
>
> Case Else
>
> stDocName = "Productsreport"
>
> End Select
>
> DoCmd.OpenReport stDocName, acViewPreview, , "ProductID IN " &
> strSelected
>
>
> '====================================================
> John Spencer
> Access MVP 2002-2005, 2007-2008
> The Hilltop Institute
> University of Maryland Baltimore County
> '====================================================
>
>
> strive4peace wrote:
> > hi Tony
> >
> > "Me![Combo28].column(1) = Like'B*'"
> > --> left(Me![Combo28].column(1),1) = "B"
> >
> > "Me![Combo28].column(1) = 'Like'C*''"
> > --> left(Me![Combo28].column(1),1) = "C"
> >
> >
> > Warm Regards,
> > Crystal
> >
> > remote programming and training
> >
> > Access Basics
> > 8-part free tutorial that covers essentials in Access
> > http://www.AccessMVP.com/strive4peace
> >
> > *
> > (: have an awesome day Smile
> > *
> >
> >
> >
> >
> > tony Jacobs wrote:
> >> I am having trouble with this code can anyone help.
> >>
> >> I have the follwing case statement that checks the value of the combo
> >> box,
> >> and based on that it will select which report to print, but I can not
> >> get it
> >> to work
> >>
> >> Select Case ReportPrint
> >>
> >> Case "Me![Combo28].column(1) = Like'B*'"
> >> stDocName = "Productsreport1"
> >>
> >> Case "Me![Combo28].column(1) = 'Like'C*''"
> >>
> >> stDocName = "Productsreport2"
> >>
> >> Case Else
> >>
> >> stDocName = "Productsreport"
> >>
> >> End Select
> >> DoCmd.OpenReport stDocName, acViewPreview, , "ProductID IN " &
> >> strSelected
> >>
> >>
> >> Thanks in advance
> >>
> >>
Back to top
Login to vote
Douglas J. Steele

External


Since: Oct 07, 2003
Posts: 10617



(Msg. 5) Posted: Fri Jul 04, 2008 10:44 am
Post subject: Re: Case statement Problem Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Given you were trying to use Column(1) in your first example, try

Select Case Left(Me.Combo28.Column(1) & "", 1)

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


"tony Jacobs" <tony RemoveThis @nospam.net> wrote in message
news:uvAAKLe3IHA.3348@TK2MSFTNGP03.phx.gbl...
> Sorry John; I did not work ! Any other ideas?
>
>
> "John Spencer" <spencer RemoveThis @chpdm.umbc> wrote in message
> news:uB2eF3d3IHA.4272@TK2MSFTNGP03.phx.gbl...
>> Select Case Left(Me.Combo28 & "",1)
>>
>> Case "B"
>> stDocName = "Productsreport1"
>>
>> Case "C"
>>
>> stDocName = "Productsreport2"
>>
>> Case Else
>>
>> stDocName = "Productsreport"
>>
>> End Select
>>
>> DoCmd.OpenReport stDocName, acViewPreview, , "ProductID IN " &
>> strSelected
>>
>>
>> '====================================================
>> John Spencer
>> Access MVP 2002-2005, 2007-2008
>> The Hilltop Institute
>> University of Maryland Baltimore County
>> '====================================================
>>
>>
>> strive4peace wrote:
>> > hi Tony
>> >
>> > "Me![Combo28].column(1) = Like'B*'"
>> > --> left(Me![Combo28].column(1),1) = "B"
>> >
>> > "Me![Combo28].column(1) = 'Like'C*''"
>> > --> left(Me![Combo28].column(1),1) = "C"
>> >
>> >
>> > Warm Regards,
>> > Crystal
>> >
>> > remote programming and training
>> >
>> > Access Basics
>> > 8-part free tutorial that covers essentials in Access
>> > http://www.AccessMVP.com/strive4peace
>> >
>> > *
>> > (: have an awesome day Smile
>> > *
>> >
>> >
>> >
>> >
>> > tony Jacobs wrote:
>> >> I am having trouble with this code can anyone help.
>> >>
>> >> I have the follwing case statement that checks the value of the combo
>> >> box,
>> >> and based on that it will select which report to print, but I can not
>> >> get it
>> >> to work
>> >>
>> >> Select Case ReportPrint
>> >>
>> >> Case "Me![Combo28].column(1) = Like'B*'"
>> >> stDocName = "Productsreport1"
>> >>
>> >> Case "Me![Combo28].column(1) = 'Like'C*''"
>> >>
>> >> stDocName = "Productsreport2"
>> >>
>> >> Case Else
>> >>
>> >> stDocName = "Productsreport"
>> >>
>> >> End Select
>> >> DoCmd.OpenReport stDocName, acViewPreview, , "ProductID IN " &
>> >> strSelected
>> >>
>> >>
>> >> Thanks in advance
>> >>
>> >>
>
>
Back to top
Login to vote
tony Jacobs

External


Since: Jul 03, 2008
Posts: 14



(Msg. 6) Posted: Fri Jul 04, 2008 11:59 am
Post subject: Re: Case statement Problem Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Doug;

No luck. No Errors but no results.

Thanks for your time


"Douglas J. Steele" <NOSPAM_djsteele DeleteThis @NOSPAM_canada.com> wrote in message
news:u$XS#Re3IHA.1808@TK2MSFTNGP04.phx.gbl...
> Given you were trying to use Column(1) in your first example, try
>
> Select Case Left(Me.Combo28.Column(1) & "", 1)
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "tony Jacobs" <tony DeleteThis @nospam.net> wrote in message
> news:uvAAKLe3IHA.3348@TK2MSFTNGP03.phx.gbl...
> > Sorry John; I did not work ! Any other ideas?
> >
> >
> > "John Spencer" <spencer DeleteThis @chpdm.umbc> wrote in message
> > news:uB2eF3d3IHA.4272@TK2MSFTNGP03.phx.gbl...
> >> Select Case Left(Me.Combo28 & "",1)
> >>
> >> Case "B"
> >> stDocName = "Productsreport1"
> >>
> >> Case "C"
> >>
> >> stDocName = "Productsreport2"
> >>
> >> Case Else
> >>
> >> stDocName = "Productsreport"
> >>
> >> End Select
> >>
> >> DoCmd.OpenReport stDocName, acViewPreview, , "ProductID IN " &
> >> strSelected
> >>
> >>
> >> '====================================================
> >> John Spencer
> >> Access MVP 2002-2005, 2007-2008
> >> The Hilltop Institute
> >> University of Maryland Baltimore County
> >> '====================================================
> >>
> >>
> >> strive4peace wrote:
> >> > hi Tony
> >> >
> >> > "Me![Combo28].column(1) = Like'B*'"
> >> > --> left(Me![Combo28].column(1),1) = "B"
> >> >
> >> > "Me![Combo28].column(1) = 'Like'C*''"
> >> > --> left(Me![Combo28].column(1),1) = "C"
> >> >
> >> >
> >> > Warm Regards,
> >> > Crystal
> >> >
> >> > remote programming and training
> >> >
> >> > Access Basics
> >> > 8-part free tutorial that covers essentials in Access
> >> > http://www.AccessMVP.com/strive4peace
> >> >
> >> > *
> >> > (: have an awesome day Smile
> >> > *
> >> >
> >> >
> >> >
> >> >
> >> > tony Jacobs wrote:
> >> >> I am having trouble with this code can anyone help.
> >> >>
> >> >> I have the follwing case statement that checks the value of the
combo
> >> >> box,
> >> >> and based on that it will select which report to print, but I can
not
> >> >> get it
> >> >> to work
> >> >>
> >> >> Select Case ReportPrint
> >> >>
> >> >> Case "Me![Combo28].column(1) = Like'B*'"
> >> >> stDocName = "Productsreport1"
> >> >>
> >> >> Case "Me![Combo28].column(1) = 'Like'C*''"
> >> >>
> >> >> stDocName = "Productsreport2"
> >> >>
> >> >> Case Else
> >> >>
> >> >> stDocName = "Productsreport"
> >> >>
> >> >> End Select
> >> >> DoCmd.OpenReport stDocName, acViewPreview, , "ProductID IN " &
> >> >> strSelected
> >> >>
> >> >>
> >> >> Thanks in advance
> >> >>
> >> >>
> >
> >
>
>
Back to top
Login to vote
Damon Heron

External


Since: Jul 06, 2007
Posts: 57



(Msg. 7) Posted: Fri Jul 04, 2008 11:59 am
Post subject: Re: Case statement Problem Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I would suggest you put a breakpoint at the beginning of your case stmt and
step thru the code, checking values-- if the code picks the correct report
name, then the problem is in your DoCmd.OpenReport stDocName, acViewPreview,
, "ProductID IN " & strSelected statement.

Damon


"tony Jacobs" <tony.TakeThisOut@nospam.net> wrote in message
news:uw4i46e3IHA.5060@TK2MSFTNGP02.phx.gbl...
> Doug;
>
> No luck. No Errors but no results.
>
> Thanks for your time
>
>
> "Douglas J. Steele" <NOSPAM_djsteele.TakeThisOut@NOSPAM_canada.com> wrote in message
> news:u$XS#Re3IHA.1808@TK2MSFTNGP04.phx.gbl...
>> Given you were trying to use Column(1) in your first example, try
>>
>> Select Case Left(Me.Combo28.Column(1) & "", 1)
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>> "tony Jacobs" <tony.TakeThisOut@nospam.net> wrote in message
>> news:uvAAKLe3IHA.3348@TK2MSFTNGP03.phx.gbl...
>> > Sorry John; I did not work ! Any other ideas?
>> >
>> >
>> > "John Spencer" <spencer.TakeThisOut@chpdm.umbc> wrote in message
>> > news:uB2eF3d3IHA.4272@TK2MSFTNGP03.phx.gbl...
>> >> Select Case Left(Me.Combo28 & "",1)
>> >>
>> >> Case "B"
>> >> stDocName = "Productsreport1"
>> >>
>> >> Case "C"
>> >>
>> >> stDocName = "Productsreport2"
>> >>
>> >> Case Else
>> >>
>> >> stDocName = "Productsreport"
>> >>
>> >> End Select
>> >>
>> >> DoCmd.OpenReport stDocName, acViewPreview, , "ProductID IN " &
>> >> strSelected
>> >>
>> >>
>> >> '====================================================
>> >> John Spencer
>> >> Access MVP 2002-2005, 2007-2008
>> >> The Hilltop Institute
>> >> University of Maryland Baltimore County
>> >> '====================================================
>> >>
>> >>
>> >> strive4peace wrote:
>> >> > hi Tony
>> >> >
>> >> > "Me![Combo28].column(1) = Like'B*'"
>> >> > --> left(Me![Combo28].column(1),1) = "B"
>> >> >
>> >> > "Me![Combo28].column(1) = 'Like'C*''"
>> >> > --> left(Me![Combo28].column(1),1) = "C"
>> >> >
>> >> >
>> >> > Warm Regards,
>> >> > Crystal
>> >> >
>> >> > remote programming and training
>> >> >
>> >> > Access Basics
>> >> > 8-part free tutorial that covers essentials in Access
>> >> > http://www.AccessMVP.com/strive4peace
>> >> >
>> >> > *
>> >> > (: have an awesome day Smile
>> >> > *
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > tony Jacobs wrote:
>> >> >> I am having trouble with this code can anyone help.
>> >> >>
>> >> >> I have the follwing case statement that checks the value of the
> combo
>> >> >> box,
>> >> >> and based on that it will select which report to print, but I can
> not
>> >> >> get it
>> >> >> to work
>> >> >>
>> >> >> Select Case ReportPrint
>> >> >>
>> >> >> Case "Me![Combo28].column(1) = Like'B*'"
>> >> >> stDocName = "Productsreport1"
>> >> >>
>> >> >> Case "Me![Combo28].column(1) = 'Like'C*''"
>> >> >>
>> >> >> stDocName = "Productsreport2"
>> >> >>
>> >> >> Case Else
>> >> >>
>> >> >> stDocName = "Productsreport"
>> >> >>
>> >> >> End Select
>> >> >> DoCmd.OpenReport stDocName, acViewPreview, , "ProductID IN " &
>> >> >> strSelected
>> >> >>
>> >> >>
>> >> >> Thanks in advance
>> >> >>
>> >> >>
>> >
>> >
>>
>>
>
>
Back to top
Login to vote
tony Jacobs

External


Since: Jul 03, 2008
Posts: 14



(Msg. 8) Posted: Fri Jul 04, 2008 1:25 pm
Post subject: Re: Case statement Problem Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

No Damon;

The problem is that the same report opens in all cases. Which means that the
case statement is not picking up the value of the combo box.
The open report works perfectly and it tells me which records in the list
box it is about to print.

Now what I am trying to do is limit the list box to all items that start
with a C, then print the C report

Limit items to all that start with a B then print all items that Start with
a B , then Print the B report (I called it report2 for example).

The "ProductID IN " & strSelected statement.is flawless. I worked it out.

Happy 4th of July. Proud to be an American.

"Damon Heron" <damon_327.DeleteThis@hotmail.com> wrote in message
news:9dmdnXMuvpjXy_PVnZ2dnUVZ_rbinZ2d@comcast.com...
> I would suggest you put a breakpoint at the beginning of your case stmt
and
> step thru the code, checking values-- if the code picks the correct report
> name, then the problem is in your DoCmd.OpenReport stDocName,
acViewPreview,
> , "ProductID IN " & strSelected statement.
>
> Damon
>
>
> "tony Jacobs" <tony.DeleteThis@nospam.net> wrote in message
> news:uw4i46e3IHA.5060@TK2MSFTNGP02.phx.gbl...
> > Doug;
> >
> > No luck. No Errors but no results.
> >
> > Thanks for your time
> >
> >
> > "Douglas J. Steele" <NOSPAM_djsteele.DeleteThis@NOSPAM_canada.com> wrote in message
> > news:u$XS#Re3IHA.1808@TK2MSFTNGP04.phx.gbl...
> >> Given you were trying to use Column(1) in your first example, try
> >>
> >> Select Case Left(Me.Combo28.Column(1) & "", 1)
> >>
> >> --
> >> Doug Steele, Microsoft Access MVP
> >> http://I.Am/DougSteele
> >> (no e-mails, please!)
> >>
> >>
> >> "tony Jacobs" <tony.DeleteThis@nospam.net> wrote in message
> >> news:uvAAKLe3IHA.3348@TK2MSFTNGP03.phx.gbl...
> >> > Sorry John; I did not work ! Any other ideas?
> >> >
> >> >
> >> > "John Spencer" <spencer.DeleteThis@chpdm.umbc> wrote in message
> >> > news:uB2eF3d3IHA.4272@TK2MSFTNGP03.phx.gbl...
> >> >> Select Case Left(Me.Combo28 & "",1)
> >> >>
> >> >> Case "B"
> >> >> stDocName = "Productsreport1"
> >> >>
> >> >> Case "C"
> >> >>
> >> >> stDocName = "Productsreport2"
> >> >>
> >> >> Case Else
> >> >>
> >> >> stDocName = "Productsreport"
> >> >>
> >> >> End Select
> >> >>
> >> >> DoCmd.OpenReport stDocName, acViewPreview, , "ProductID IN " &
> >> >> strSelected
> >> >>
> >> >>
> >> >> '====================================================
> >> >> John Spencer
> >> >> Access MVP 2002-2005, 2007-2008
> >> >> The Hilltop Institute
> >> >> University of Maryland Baltimore County
> >> >> '====================================================
> >> >>
> >> >>
> >> >> strive4peace wrote:
> >> >> > hi Tony
> >> >> >
> >> >> > "Me![Combo28].column(1) = Like'B*'"
> >> >> > --> left(Me![Combo28].column(1),1) = "B"
> >> >> >
> >> >> > "Me![Combo28].column(1) = 'Like'C*''"
> >> >> > --> left(Me![Combo28].column(1),1) = "C"
> >> >> >
> >> >> >
> >> >> > Warm Regards,
> >> >> > Crystal
> >> >> >
> >> >> > remote programming and training
> >> >> >
> >> >> > Access Basics
> >> >> > 8-part free tutorial that covers essentials in Access
> >> >> > http://www.AccessMVP.com/strive4peace
> >> >> >
> >> >> > *
> >> >> > (: have an awesome day Smile
> >> >> > *
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > tony Jacobs wrote:
> >> >> >> I am having trouble with this code can anyone help.
> >> >> >>
> >> >> >> I have the follwing case statement that checks the value of the
> > combo
> >> >> >> box,
> >> >> >> and based on that it will select which report to print, but I can
> > not
> >> >> >> get it
> >> >> >> to work
> >> >> >>
> >> >> >> Select Case ReportPrint
> >> >> >>
> >> >> >> Case "Me![Combo28].column(1) = Like'B*'"
> >> >> >> stDocName = "Productsreport1"
> >> >> >>
> >> >> >> Case "Me![Combo28].column(1) = 'Like'C*''"
> >> >> >>
> >> >> >> stDocName = "Productsreport2"
> >> >> >>
> >> >> >> Case Else
> >> >> >>
> >> >> >> stDocName = "Productsreport"
> >> >> >>
> >> >> >> End Select
> >> >> >> DoCmd.OpenReport stDocName, acViewPreview, , "ProductID IN " &
> >> >> >> strSelected
> >> >> >>
> >> >> >>
> >> >> >> Thanks in advance
> >> >> >>
> >> >> >>
> >> >
> >> >
> >>
> >>
> >
> >
>
>
Back to top
Login to vote
Display posts from previous:   
       Home -> Office other -> General Discussions All times are: Eastern Time (US & Canada) (change)
Goto page 1, 2, 3, 4
Page 1 of 4

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
 Office
  Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET