|
Prev: Not Updating
Next: function reference
From: tony Jacobs on 6 Jul 2008 12:56 Excellent Idea. I love it. I will change it to that. Thanks Marsh !!! "Marshall Barton" <marshbarton(a)wowway.com> wrote in message news:f3vu641h812jdmkt651d8tb7lv07jan6c3(a)4ax.com... > 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 > > > I think you are going about this the wrong way. The idea of > using Select Case for the Where clause from your table is > hard coding way too much. > > I suggest that you add another field to the table. The > field would indicate which report should be used and can be > included in the combo box's RowSource as Column(2). This > way, the code would have no dependency on the where > condition. > > If the field contains 1 for the Productsreport1 case, 2 for > Productsreport2 and nothing for when you want to use > Productsreport, then the code could simply be: > > stDocName = "Productsreport" & Me.combo28.Column(2) > DoCmd.OpenReport stDocName, . . . > > -- > Marsh > MVP [MS Access]
|
Pages: 1 Prev: Not Updating Next: function reference |