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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with row source to list box

Status
Not open for further replies.

magi

Programmer
Nov 20, 2001
13
US
hi
im trying to use a list box on a ms access xp .adp form, with data in sql server 2000. but the code seems not working

With Me.FrmVWSWSw1
.RowSourceType = "Table/View/StoredProc"
.RowSource = "select * Table where where Name like '" & na & "' "
.ColumnCount = 7
End With

nothing is displayed in list box
please help me
 
.RowSource = "select * Table where where Name like '" & na & "' "

Well first off you don't need two WHERE clauses - that's just greedy !

But you do need a FROM cluase.

Also the Like statement expects a wildcard character somewhere, otherwise you might as well replace Like with =

( & to make reading / debug / maintenance easier - ALWAYS capitalise the SQL key words as below )

.RowSource = "SELECT * FROM Table WHERE Name = '" & na & "';"

or

.RowSource = "SELECT * FROM Table WHERE Name = '*" & na & "*';"
Delete the inapproprate "*".


'ope-that-'elps.

G LS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top