|
From: tony Jacobs on 5 Jul 2008 09:48 Doug; The Value of the Me.Combo28.Column(1) is Like 'B*' , and any other variations.(Like 'C*', etc.....). You helped me with this earlier on. The lstbox gets poulated with items that start with a B when I select a combo box value of Like 'B*', and so on. No all I want to do is print the items in the lstbox , using the corresponding report. i.e: print the B* ( items that start with a B) on the B report (Report2) , C Items .. By the way; I put a message box that returns the contents of Me.Combo28.Column(1), and it returns the correct value. I am thinking of using If statements. This is my first time using Case statements. and the spaces between the Like and the first ' is correct, only one space. I am Stumped now. "Douglas J. Steele" <NOSPAM_djsteele(a)NOSPAM_canada.com> wrote in message news:uTWOuIo3IHA.4272(a)TK2MSFTNGP03.phx.gbl... > The problem would appear to be that the value in Me.Combo28.Column(1) is not > what you're expecting it to be. In other words, whatever value is there > never starts with either a B or a C. > > -- > Doug Steele, Microsoft Access MVP > http://I.Am/DougSteele > (no private e-mails, please) > > > "tony Jacobs" <tony(a)nospam.net> wrote in message > news:OFFI6gk3IHA.1420(a)TK2MSFTNGP06.phx.gbl... > > Damon; > > I tried your code and I added 3 message boxes at the end of the code to > > see > > the value of the stDocName and it is always the report name in the Case > > else > > statement. > > > > It seems that we are close, but the conditional reports are not being > > picked > > up . > > > > > > "Damon Heron" <damon_327(a)hotmail.com> wrote in message > > news:-YidnckdMbU5N_PVnZ2dnUVZ_hqdnZ2d(a)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(a)nospam.net> wrote in message > >> news:eBGBGrf3IHA.2580(a)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(a)hotmail.com> wrote in message > >> > news:9dmdnXMuvpjXy_PVnZ2dnUVZ_rbinZ2d(a)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(a)nospam.net> wrote in message > >> >> news:uw4i46e3IHA.5060(a)TK2MSFTNGP02.phx.gbl... > >> >> > Doug; > >> >> > > >> >> > No luck. No Errors but no results. > >> >> > > >> >> > Thanks for your time > >> >> > > >> >> > > >> >> > "Douglas J. Steele" <NOSPAM_djsteele(a)NOSPAM_canada.com> wrote in > >> >> > message > >> >> > news:u$XS#Re3IHA.1808(a)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(a)nospam.net> wrote in message > >> >> >> news:uvAAKLe3IHA.3348(a)TK2MSFTNGP03.phx.gbl... > >> >> >> > Sorry John; I did not work ! Any other ideas? > >> >> >> > > >> >> >> > > >> >> >> > "John Spencer" <spencer(a)chpdm.umbc> wrote in message > >> >> >> > news:uB2eF3d3IHA.4272(a)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 :) > >> >> >> >> > * > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > > >> >> >> >> > 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 > >> >> >> >> >> > >> >> >> >> >> > >> >> >> > > >> >> >> > > >> >> >> > >> >> >> > >> >> > > >> >> > > >> >> > >> >> > >> > > >> > > >> > >> > > > > > >
From: Douglas J. Steele on 5 Jul 2008 10:19 If the combo box is returning Like 'B*', you need code like: Select Case Nz(Me.Combo28.Column(1), "") Case "Like 'B*'" stDocName = "Productsreport1" Case "Like 'C*'" stDocName = "Productsreport2" Case Else stDocName = "Productsreport" End Select -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "tony Jacobs" <tony(a)nospam.net> wrote in message news:e1VqbWq3IHA.1196(a)TK2MSFTNGP05.phx.gbl... > Doug; > The Value of the Me.Combo28.Column(1) is Like 'B*' , and any other > variations.(Like 'C*', etc.....). You helped me with this earlier on. The > lstbox gets poulated with items that start with a B when I select a combo > box value of Like 'B*', and so on. > > No all I want to do is print the items in the lstbox , using the > corresponding report. i.e: print > the B* ( items that start with a B) on the B report (Report2) , C Items .. > By the way; I put a message box that returns the contents of > Me.Combo28.Column(1), and it returns the correct value. > > I am thinking of using If statements. This is my first time using Case > statements. and the spaces between the Like and the first ' is correct, > only one space. > > I am Stumped now. > > "Douglas J. Steele" <NOSPAM_djsteele(a)NOSPAM_canada.com> wrote in message > news:uTWOuIo3IHA.4272(a)TK2MSFTNGP03.phx.gbl... >> The problem would appear to be that the value in Me.Combo28.Column(1) is > not >> what you're expecting it to be. In other words, whatever value is there >> never starts with either a B or a C. >> >> -- >> Doug Steele, Microsoft Access MVP >> http://I.Am/DougSteele >> (no private e-mails, please) >> >> >> "tony Jacobs" <tony(a)nospam.net> wrote in message >> news:OFFI6gk3IHA.1420(a)TK2MSFTNGP06.phx.gbl... >> > Damon; >> > I tried your code and I added 3 message boxes at the end of the code to >> > see >> > the value of the stDocName and it is always the report name in the Case >> > else >> > statement. >> > >> > It seems that we are close, but the conditional reports are not being >> > picked >> > up . >> > >> > >> > "Damon Heron" <damon_327(a)hotmail.com> wrote in message >> > news:-YidnckdMbU5N_PVnZ2dnUVZ_hqdnZ2d(a)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(a)nospam.net> wrote in message >> >> news:eBGBGrf3IHA.2580(a)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(a)hotmail.com> wrote in message >> >> > news:9dmdnXMuvpjXy_PVnZ2dnUVZ_rbinZ2d(a)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(a)nospam.net> wrote in message >> >> >> news:uw4i46e3IHA.5060(a)TK2MSFTNGP02.phx.gbl... >> >> >> > Doug; >> >> >> > >> >> >> > No luck. No Errors but no results. >> >> >> > >> >> >> > Thanks for your time >> >> >> > >> >> >> > >> >> >> > "Douglas J. Steele" <NOSPAM_djsteele(a)NOSPAM_canada.com> wrote in >> >> >> > message >> >> >> > news:u$XS#Re3IHA.1808(a)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(a)nospam.net> wrote in message >> >> >> >> news:uvAAKLe3IHA.3348(a)TK2MSFTNGP03.phx.gbl... >> >> >> >> > Sorry John; I did not work ! Any other ideas? >> >> >> >> > >> >> >> >> > >> >> >> >> > "John Spencer" <spencer(a)chpdm.umbc> wrote in message >> >> >> >> > news:uB2eF3d3IHA.4272(a)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 :) >> >> >> >> >> > * >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > 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 >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> >> >> > >> >> >> >> >> >> >> >> >> >> >> > >> >> >> > >> >> >> >> >> >> >> >> > >> >> > >> >> >> >> >> > >> > >> >> > >
|
Pages: 1 Prev: Conditional Formatting - Embedded Subreport Next: dlookup |