Prev: Outlook Express/Microsoft Office 2007
Next: autonumber
From: deb on 23 Apr 2010 13:38 access 2003 On form f018ContrPerf is have a listbox called lstUnitType(multiselect=none). How can I determine if all items in listbox are the same? ie all ST or all IT... If they are the same then Me.f018ContrPerfDetails.Form.optHP.Visible = True Me.f018ContrPerfDetails.Form.FrameElem_Label.Visible = True -- deb
From: John W. Vinson on 23 Apr 2010 14:04 On Fri, 23 Apr 2010 10:38:01 -0700, deb <deb(a)discussions.microsoft.com> wrote: >access 2003 > >On form f018ContrPerf is have a listbox called lstUnitType(multiselect=none). > >How can I determine if all items in listbox are the same? ie all ST or all >IT... > >If they are the same then >Me.f018ContrPerfDetails.Form.optHP.Visible = True >Me.f018ContrPerfDetails.Form.FrameElem_Label.Visible = True What's the listbox's RowSource? Where does it get its data FROM? And why on Earth would you have a listbox to select from multiple identical values??? -- John W. Vinson [MVP]
From: deb on 23 Apr 2010 15:23 User can either select a specific unit or can sellect All Units from the UnitNo combobox. If the user selects all units then I need to know if all the units are alike. because if they are all ST then I will need to display an ST form. If some are ST and one is a IT the I must display a different form. Thank you for your help! Private Sub UnitNo_AfterUpdate() If IsNull(Me.UnitNo) Then 'make subform visible Me.f018ContrPerfEmissGuaDetails.Form.Visible = False Else Me.f018ContrPerfEmissGuaDetails.Form.Visible = True End If Select Case Me!UnitNo.Value ' rowsource for lstUnitType Dim strsql2 As String Case 0 ' All units strsql2 = "SELECT DISTINCT t000GFacts.UnitType, t040Project.ProjectID, t040Project.ProjectName, " & _ " t041ProjectDetails.UnitID, t000GFacts.Unit " & _ " FROM t040Project INNER JOIN (t000GFacts INNER JOIN t041ProjectDetails " & _ " ON t000GFacts.UnitID = t041ProjectDetails.UnitID) " & _ " ON t040Project.ProjectID = t041ProjectDetails.ProjectID " & _ " WHERE (((t040Project.ProjectID)=[Forms]![f001ProjectReview]![ProjectID])) " & _ " ORDER BY t000GFacts.Unit;" Me.lstUnitType.RowSource = strsql2 Me.lstUnitType.Requery Case Else 'selected unit strsql2 = "SELECT DISTINCT t000GFacts.UnitType, t040Project.ProjectID, t040Project.ProjectName, " & _ " t041ProjectDetails.UnitID, t000GFacts.Unit " & _ " FROM t040Project INNER JOIN (t000GFacts INNER JOIN t041ProjectDetails " & _ " ON t000GFacts.UnitID = t041ProjectDetails.UnitID) " & _ " ON t040Project.ProjectID = t041ProjectDetails.ProjectID " & _ " WHERE (((t041ProjectDetails.UnitID)=[Forms]![f001ProjectReview]![f018ContrPerfEmissGua].[Form]![UnitNo])) " & _ " ORDER BY t000GFacts.Unit;" Me.lstUnitType.RowSource = strsql2 Me.lstUnitType.Requery ' edit code Display Frame Element ( HP IP LP) If (Me.lstUnitType.Value) = "ST" Then Me.f018ContrPerfEmissGuaDetails.Form.optHPorIPorLP.Visible = True Me.f018ContrPerfEmissGuaDetails.Form.FrameElem_Label.Visible = True Else Me.f018ContrPerfEmissGuaDetails.Form.optHPorIPorLP.Visible = False Me.f018ContrPerfEmissGuaDetails.Form.FrameElem_Label.Visible = False MsgBox " else" End If End Select -- deb "John W. Vinson" wrote: > On Fri, 23 Apr 2010 10:38:01 -0700, deb <deb(a)discussions.microsoft.com> wrote: > > >access 2003 > > > >On form f018ContrPerf is have a listbox called lstUnitType(multiselect=none). > > > >How can I determine if all items in listbox are the same? ie all ST or all > >IT... > > > >If they are the same then > >Me.f018ContrPerfDetails.Form.optHP.Visible = True > >Me.f018ContrPerfDetails.Form.FrameElem_Label.Visible = True > > What's the listbox's RowSource? Where does it get its data FROM? > > And why on Earth would you have a listbox to select from multiple identical > values??? > -- > > John W. Vinson [MVP] > . >
From: John W. Vinson on 23 Apr 2010 16:39 On Fri, 23 Apr 2010 12:23:02 -0700, deb <deb(a)discussions.microsoft.com> wrote: >User can either select a specific unit or can sellect All Units from the >UnitNo combobox. > >If the user selects all units then I need to know if all the units are alike. >because if they are all ST then I will need to display an ST form. If some >are ST and one is a IT the I must display a different form. Remember... nobody here knows anything about your business or your database unless you post it. What does it mean for units to be "alike"? Is ST a field, a portion of a field, the primary key of the listbox's record, a different field in the listboxes' record? I.e. what steps must Access take to determine "if they are all ST"? -- John W. Vinson [MVP]
From: deb on 3 May 2010 16:05
sorry it took so long to answer, I was in class all week. The listbox is unbound and the primary key of the listbox's record is UnitType (text) some of the options in the list box may be something like... ST ST ST or it could be ST BFTG and so on so if the list box displays: ST ST ST Then display the ST form. -- deb "John W. Vinson" wrote: > On Fri, 23 Apr 2010 12:23:02 -0700, deb <deb(a)discussions.microsoft.com> wrote: > > >User can either select a specific unit or can sellect All Units from the > >UnitNo combobox. > > > >If the user selects all units then I need to know if all the units are alike. > >because if they are all ST then I will need to display an ST form. If some > >are ST and one is a IT the I must display a different form. > > Remember... nobody here knows anything about your business or your database > unless you post it. What does it mean for units to be "alike"? Is ST a field, > a portion of a field, the primary key of the listbox's record, a different > field in the listboxes' record? I.e. what steps must Access take to determine > "if they are all ST"? > > -- > > John W. Vinson [MVP] > . > |