From: DawnTreader on 23 Mar 2010 15:38 Hello All i need a little help trying to get this to work i have 3 sets of lables for 3 different languages for my fields. i am trying to use a variable stored in a combo box on a floating always open form to determine which language label should show. what is wrong with this code? Private Sub frmLanguage() Dim ctl As Control Dim frmUserLanguage As String Dim lblLanguage As String frmUserLanguage = Forms!frmMainMenu.Form!cboEmployee.Column(18) MsgBox frmUserLanguage For Each ctl In Me.Controls If ctl.ControlType = acLabel Then lblLanguage = ctl.Tag MsgBox lblLanguage Select Case lblLanguage Case lblLanguage = frmUserLanguage ctl.Visible = True Case lblLanguage = "Always" ctl.Visible = True Case Else ctl.Visible = False End Select End If Next End Sub -- As always, any and all help appreciated! :)
From: DawnTreader on 23 Mar 2010 16:24 doh! figured it out, thanks any ways. Private Sub frmLanguage() Dim ctl As Control Dim frmUserLanguage As String Dim lblLanguage As String frmUserLanguage = Forms!frmMainMenu!cboEmployee.Column(18) For Each ctl In Me.Controls If ctl.ControlType = acLabel Then lblLanguage = ctl.Tag Select Case lblLanguage Case frmUserLanguage ctl.Visible = True Case "Always" ctl.Visible = True Case Else ctl.Visible = False End Select End If Next End Sub -- As always, any and all help appreciated! :) "DawnTreader" wrote: > Hello All > > i need a little help trying to get this to work > > i have 3 sets of lables for 3 different languages for my fields. i am trying > to use a variable stored in a combo box on a floating always open form to > determine which language label should show. what is wrong with this code? > > Private Sub frmLanguage() > Dim ctl As Control > Dim frmUserLanguage As String > Dim lblLanguage As String > > frmUserLanguage = Forms!frmMainMenu.Form!cboEmployee.Column(18) > > MsgBox frmUserLanguage > > For Each ctl In Me.Controls > If ctl.ControlType = acLabel Then > lblLanguage = ctl.Tag > MsgBox lblLanguage > Select Case lblLanguage > Case lblLanguage = frmUserLanguage > ctl.Visible = True > Case lblLanguage = "Always" > ctl.Visible = True > Case Else > ctl.Visible = False > End Select > End If > Next > End Sub > > -- > As always, any and all help appreciated! :)
From: Marshall Barton on 23 Mar 2010 16:45 DawnTreader wrote: >i have 3 sets of lables for 3 different languages for my fields. i am trying >to use a variable stored in a combo box on a floating always open form to >determine which language label should show. what is wrong with this code? > >Private Sub frmLanguage() > Dim ctl As Control > Dim frmUserLanguage As String > Dim lblLanguage As String > > frmUserLanguage = Forms!frmMainMenu.Form!cboEmployee.Column(18) > > MsgBox frmUserLanguage > > For Each ctl In Me.Controls > If ctl.ControlType = acLabel Then > lblLanguage = ctl.Tag > MsgBox lblLanguage > Select Case lblLanguage > Case lblLanguage = frmUserLanguage > ctl.Visible = True > Case lblLanguage = "Always" > ctl.Visible = True > Case Else > ctl.Visible = False > End Select > End If > Next >End Sub Your Case statments us invalis syntax. Try something more like: Select Case lblLanguage Case frmUserLanguage, "Always" ctl.Visible = True Case Else ctl.Visible = False End Select Or, more concisely: ctl.Visible = lblLanguage = frmUserLanguage _ Or lblLanguage = "Always" -- Marsh MVP [MS Access]
From: DawnTreader on 5 Apr 2010 17:03 Huh? are you saying i could do away with the select statement altogether? -- As always, any and all help appreciated! :) "Marshall Barton" wrote: > DawnTreader wrote: > >i have 3 sets of lables for 3 different languages for my fields. i am trying > >to use a variable stored in a combo box on a floating always open form to > >determine which language label should show. what is wrong with this code? > > > >Private Sub frmLanguage() > > Dim ctl As Control > > Dim frmUserLanguage As String > > Dim lblLanguage As String > > > > frmUserLanguage = Forms!frmMainMenu.Form!cboEmployee.Column(18) > > > > MsgBox frmUserLanguage > > > > For Each ctl In Me.Controls > > If ctl.ControlType = acLabel Then > > lblLanguage = ctl.Tag > > MsgBox lblLanguage > > Select Case lblLanguage > > Case lblLanguage = frmUserLanguage > > ctl.Visible = True > > Case lblLanguage = "Always" > > ctl.Visible = True > > Case Else > > ctl.Visible = False > > End Select > > End If > > Next > >End Sub > > > Your Case statments us invalis syntax. Try something more > like: > > Select Case lblLanguage > Case frmUserLanguage, "Always" > ctl.Visible = True > Case Else > ctl.Visible = False > End Select > > Or, more concisely: > > ctl.Visible = lblLanguage = frmUserLanguage _ > Or lblLanguage = "Always" > > -- > Marsh > MVP [MS Access] > . >
From: Douglas J. Steele on 5 Apr 2010 17:10
Yes, that's what Marsh is saying For Each ctl In Me.Controls If ctl.ControlType = acLabel Then lblLanguage = ctl.Tag MsgBox lblLanguage ctl.Visible = ((lblLanguage = frmUserLanguage) _ Or (lblLanguage = "Always")) End If Next ctl -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "DawnTreader" <DawnTreader(a)discussions.microsoft.com> wrote in message news:CC5F2D35-E888-436A-8598-A4CAEBCB1608(a)microsoft.com... > Huh? > > are you saying i could do away with the select statement altogether? > -- > As always, any and all help appreciated! :) > > > "Marshall Barton" wrote: > >> DawnTreader wrote: >> >i have 3 sets of lables for 3 different languages for my fields. i am >> >trying >> >to use a variable stored in a combo box on a floating always open form >> >to >> >determine which language label should show. what is wrong with this >> >code? >> > >> >Private Sub frmLanguage() >> > Dim ctl As Control >> > Dim frmUserLanguage As String >> > Dim lblLanguage As String >> > >> > frmUserLanguage = Forms!frmMainMenu.Form!cboEmployee.Column(18) >> > >> > MsgBox frmUserLanguage >> > >> > For Each ctl In Me.Controls >> > If ctl.ControlType = acLabel Then >> > lblLanguage = ctl.Tag >> > MsgBox lblLanguage >> > Select Case lblLanguage >> > Case lblLanguage = frmUserLanguage >> > ctl.Visible = True >> > Case lblLanguage = "Always" >> > ctl.Visible = True >> > Case Else >> > ctl.Visible = False >> > End Select >> > End If >> > Next >> >End Sub >> >> >> Your Case statments us invalis syntax. Try something more >> like: >> >> Select Case lblLanguage >> Case frmUserLanguage, "Always" >> ctl.Visible = True >> Case Else >> ctl.Visible = False >> End Select >> >> Or, more concisely: >> >> ctl.Visible = lblLanguage = frmUserLanguage _ >> Or lblLanguage = "Always" >> >> -- >> Marsh >> MVP [MS Access] >> . >> |