Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combox Display 1

Status
Not open for further replies.

fabby1

Technical User
Mar 9, 2004
206
GB
Hi

I have a combo box that is built from the following sql

Code:
Private Sub grpUser_AfterUpdate()

    On Error Resume Next
    Dim strUser As String
    Select Case grpUser.Value
        Case 1
            strUser = "DIRC"
        Case 2
            strUser = "BMAN"
        Case 3
            strUser = "BADM"
    End Select
    G_Level = strUser
    cboUser.RowSource = "Select Surname, FirstName, Staffno, PWord, REGCode " & _
                        "FROM dbo_Master1 " & _
                        "WHERE ACLEVEL = '" & strUser & "'" & _
                        "ORDER BY ACLEVEL;"
     Me.cboUser.Visible = True
     Me.Box22.Visible = True
     Me.Label23.Visible = True
     Me.Label24.Visible = True
     Me.txtPassword.SetFocus
End Sub

All I want to disdplay in the Combo box is the Forename and Surname.

But

I want to use the other fields to set some global variable

Heres the AfterUpdate

Code:
Private Sub cboUser_AfterUpdate()

G_Surname = Me.cboUser.Column(0)
G_Forename = Me.cboUser.Column(1)
G_AStaffNo = Me.cboUser.Column(2)
G_Password = Me.cboUser.Column(3)
G_Region = Me.cboUser.Column(4)

Select Case G_Level
        Case "DIRC"
            G_AStaffNo = "*"
            G_Region = Me.cboUser.Column(4)
        Case "BMAN"
            G_AStaffNo = "*"
            G_Region = Me.cboUser.Column(4)
        Case "BADM"
            G_AStaffNo = Me.cboUser.Column(2)
            G_Region = "*"
        End Select
 
Me.txtPassword.Visible = True
Me.txtPassword.SetFocus

The problem is that when I set the combobox

ColumnCount value to 2 it won't pass the values from the fields.

I want to be able to pass the values but not display the scroll bars in the combobox so that the user can scroll around


Hope you can help

Thanks

Phil
 
in the column widths property just put
Code:
;;0;0
which means the 1st 2 columns are auto width & the next 2 are 0 width. Should sort you out.

hth

Ben

----------------------------------------------
Ben O'Hara "Where are all the stupid people from...
...And how'd they get so dumb?"
rockband.gif
NoFX-The Decline
----------------------------------------------
Want to get great answers to your Tek-Tips questions? Have a
 
Ben

Thanks Pal, simple but it works

Thanks
 
simple but it works
Just like me then!!

Cheers

B

----------------------------------------------
Ben O'Hara "Where are all the stupid people from...
...And how'd they get so dumb?"
rockband.gif
NoFX-The Decline
----------------------------------------------
Want to get great answers to your Tek-Tips questions? Have a
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top