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      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Case statement Problem

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

External


Since: Apr 04, 2006
Posts: 946



(Msg. 9) Posted: Fri Jul 04, 2008 2:55 pm
Post subject: Re: Case statement Problem [Login to view extended thread Info.]
Archived from groups: microsoft>public>access, others (more info?)

Hi Tony,

did you compile your code?


'~~~~~~~~~ Compile ~~~~~~~~~

Whenever you change code, references, or switch versions, you should
always compile before executing.

from the menu in a VBE (module) window: Debug, Compile

fix any errors on the yellow highlighted lines

keep compiling until nothing happens (this is good!)

~~
if you run code without compiling it, you risk corrupting your database

~~~~~~~~~~~~~~~~

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

Happy Independence Day!


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:
> 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 RemoveThis @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 RemoveThis @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 RemoveThis @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 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
Damon Heron

External


Since: Jul 06, 2007
Posts: 68



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

Before the Select Case statement, put:

debug.print Left(Me.Combo28.column(1) & "",1)

if the correct answer appears in the immediate window, then you might try:
dim myrpt as variant
myrpt= Left(Me.Combo28.Column(1) & "",1)
Select Case myrpt
Case "B"
............
Case "C"
etc.

There is no way the correct report name would not be assigned to stDocName
in this case.

Damon



"tony Jacobs" <tony.DeleteThis@nospam.net> wrote in message
news:eBGBGrf3IHA.2580@TK2MSFTNGP06.phx.gbl...
> 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
Douglas J. Steele

External


Since: Oct 07, 2003
Posts: 10796



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

If the Case statement isn't working, then stDocName shouldn't have a value
and the OpenReport command should fail.

Put a breakpoint in the code and make sure stDocName is, in fact, being set
correctly.

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


"tony Jacobs" <tony.RemoveThis@nospam.net> wrote in message
news:eBGBGrf3IHA.2580@TK2MSFTNGP06.phx.gbl...
> 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.RemoveThis@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.RemoveThis@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.RemoveThis@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.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
strive4peace

External


Since: Apr 04, 2006
Posts: 946



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

another thing to keep in mind is that column indexes start at zero ...
so Column(1) is the second column

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
*




Damon Heron wrote:
> Before the Select Case statement, put:
>
> debug.print Left(Me.Combo28.column(1) & "",1)
>
> if the correct answer appears in the immediate window, then you might try:
> dim myrpt as variant
> myrpt= Left(Me.Combo28.Column(1) & "",1)
> Select Case myrpt
> Case "B"
> ...........
> Case "C"
> etc.
>
> There is no way the correct report name would not be assigned to stDocName
> in this case.
>
> Damon
>
>
>
> "tony Jacobs" <tony.DeleteThis@nospam.net> wrote in message
> news:eBGBGrf3IHA.2580@TK2MSFTNGP06.phx.gbl...
>> 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
tony Jacobs

External


Since: Jul 03, 2008
Posts: 14



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

Yes I did, I always do. Thanks though Wink

"strive4peace" <strive4peace2006.DeleteThis@yahoo.com> wrote in message
news:evrZUeg3IHA.2060@TK2MSFTNGP02.phx.gbl...
> Hi Tony,
>
> did you compile your code?
>
>
> '~~~~~~~~~ Compile ~~~~~~~~~
>
> Whenever you change code, references, or switch versions, you should
> always compile before executing.
>
> from the menu in a VBE (module) window: Debug, Compile
>
> fix any errors on the yellow highlighted lines
>
> keep compiling until nothing happens (this is good!)
>
> ~~
> if you run code without compiling it, you risk corrupting your database
>
> ~~~~~~~~~~~~~~~~
>
> "Happy 4th of July. Proud to be an American."
>
> Happy Independence Day!
>
>
> 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:
> > 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
tony Jacobs

External


Since: Jul 03, 2008
Posts: 14



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

Compile Error
Expected Expression if I put ? Debug.Print Left(Me.Combo28.Column(1) &
"", 1) in thr immediate window

Also I get an error that the Value of the Combo Box is not set yet.or not
calculated. I used to be able to use the immediate window very successfully.
Please tell me if I am doing something wrong.

Thanks



"Damon Heron" <damon_327 DeleteThis @hotmail.com> wrote in message
news:-YidnckdMbU5N_PVnZ2dnUVZ_hqdnZ2d@comcast.com...
> Before the Select Case statement, put:
>
> debug.print Left(Me.Combo28.column(1) & "",1)
>
> if the correct answer appears in the immediate window, then you might try:
> dim myrpt as variant
> myrpt= Left(Me.Combo28.Column(1) & "",1)
> Select Case myrpt
> Case "B"
> ...........
> Case "C"
> etc.
>
> There is no way the correct report name would not be assigned to stDocName
> in this case.
>
> Damon
>
>
>
> "tony Jacobs" <tony DeleteThis @nospam.net> wrote in message
> news:eBGBGrf3IHA.2580@TK2MSFTNGP06.phx.gbl...
> > 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
tony Jacobs

External


Since: Jul 03, 2008
Posts: 14



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

Crystal

Yes ;Column 1 is the second column which is column(1), which contains the
value that shows up in the combobox.and is the one I need.

Thanks

"strive4peace" <strive4peace2006.RemoveThis@yahoo.com> wrote in message
news:udJXx1i3IHA.5112@TK2MSFTNGP03.phx.gbl...
> another thing to keep in mind is that column indexes start at zero ...
> so Column(1) is the second column
>
> 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
> *
>
>
>
>
> Damon Heron wrote:
> > Before the Select Case statement, put:
> >
> > debug.print Left(Me.Combo28.column(1) & "",1)
> >
> > if the correct answer appears in the immediate window, then you might
try:
> > dim myrpt as variant
> > myrpt= Left(Me.Combo28.Column(1) & "",1)
> > Select Case myrpt
> > Case "B"
> > ...........
> > Case "C"
> > etc.
> >
> > There is no way the correct report name would not be assigned to
stDocName
> > in this case.
> >
> > Damon
> >
> >
> >
> > "tony Jacobs" <tony.RemoveThis@nospam.net> wrote in message
> > news:eBGBGrf3IHA.2580@TK2MSFTNGP06.phx.gbl...
> >> 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.RemoveThis@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.RemoveThis@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.RemoveThis@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.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. 16) Posted: Fri Jul 04, 2008 8:45 pm
Post subject: Re: Case statement Problem Compile Error [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Okay a quick update: I put a message box that printed the value of the Combo
box, and the left statement returns the letter "L" only

that's why the report selection is bypassed to the Case Else Statement .

Please note that the coulmn(1) in the combobox is as follows

Product Name
Like 'C*'
Like 'P*'
Like 'B*'
Like '*'
Like 'Z*'
Like"[B]*"
Like "[BC]*"


I am thinking of trying the combobox without the Left function.


"tony Jacobs" <tony.TakeThisOut@nospam.net> wrote in message
news:uN16#Mj3IHA.1204@TK2MSFTNGP04.phx.gbl...
> Compile Error
> Expected Expression if I put ? Debug.Print Left(Me.Combo28.Column(1) &
> "", 1) in thr immediate window
>
> Also I get an error that the Value of the Combo Box is not set yet.or not
> calculated. I used to be able to use the immediate window very
successfully.
> Please tell me if I am doing something wrong.
>
> Thanks
>
>
>
> "Damon Heron" <damon_327.TakeThisOut@hotmail.com> wrote in message
> news:-YidnckdMbU5N_PVnZ2dnUVZ_hqdnZ2d@comcast.com...
> > Before the Select Case statement, put:
> >
> > debug.print Left(Me.Combo28.column(1) & "",1)
> >
> > if the correct answer appears in the immediate window, then you might
try:
> > dim myrpt as variant
> > myrpt= Left(Me.Combo28.Column(1) & "",1)
> > Select Case myrpt
> > Case "B"
> > ...........
> > Case "C"
> > etc.
> >
> > There is no way the correct report name would not be assigned to
stDocName
> > in this case.
> >
> > Damon
> >
> >
> >
> > "tony Jacobs" <tony.TakeThisOut@nospam.net> wrote in message
> > news:eBGBGrf3IHA.2580@TK2MSFTNGP06.phx.gbl...
> > > 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.TakeThisOut@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.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