The default for a list box set to a query string

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here is my code so far:
Private Sub Form_Load()
Nametxt = GetUserName()
Dim SQLString As String
SQLString = "SELECT Printers.Name FROM GetUserName;"
List4 = SQLString
End Sub

My getusername function works, which takes your username
off of active directory and places it into a text box.
But I then have a list box which contains all of my
printers on my server. In my tables each username has a
set printer correlated to their username. I would like
that printer to automatically be defaulted to in the list
box. Any suggestions? Thanks much!!!
 
-----Original Message-----
Here is my code so far:
Private Sub Form_Load()
Nametxt = GetUserName()
Dim SQLString As String
SQLString = "SELECT Printers.Name FROM GetUserName;"
List4 = SQLString
End Sub

My getusername function works, which takes your username
off of active directory and places it into a text box.
But I then have a list box which contains all of my
printers on my server. In my tables each username has a
set printer correlated to their username. I would like
that printer to automatically be defaulted to in the list
box. Any suggestions? Thanks much!!!
.
Hi, assuming Nametxt now stores the user name and that
your list has a single column, then try...

List4.value=Nametxt.value

Luck
Jonathan
 
Back
Top