The default for a list box set to a query string

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!!!
 
J

Jonathan Parminter

-----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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top