Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Storm
Starting Member
10 Posts |
Posted - 2009-08-21 : 08:35:39
|
| Here is the situation I have. I have a access program that I'm building and I have a list box that when someone starts typing the lastname those names start showing up underneath in another list box. The problem is that the database we're looking at is too large and it won't ever finish loading all the names so you can't ever look up someone. So I need a revolving top 30 sql statement that will allow just 30 names at any given time to show up in the main list box. However when the user starts typing in the lookup list box above it, it will start to show those names.Sounds like I need 2 sql statements. One for the main list box and one for the lookup list box. I don't know anything about VBA scriping so please don't give me any answer that has to do with that, as I won't know what the heck to do.Thanks |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-08-21 : 08:40:27
|
Hire a consultant sounds better? N 56°04'39.26"E 12°55'05.63" |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-08-21 : 08:44:29
|
Sometimes it will be the better way... No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2009-08-21 : 10:21:20
|
| Are they names stored in an Access table, or in a SQL Server linked table? |
 |
|
|
Storm
Starting Member
10 Posts |
Posted - 2009-08-21 : 10:31:23
|
| SQL Server linked tableAlso I now have the sql for returning the names in the main list box. (I decided to go with top 18 instead of 30). I just don't know how to get the sql statement for the lookup list box. When the user starts typing a name in the lookup list box it needs to start showing the results down in the Main list box.SELECT TOP 18 , Users.[CurrentLastName] AS [Last], Users.[CurrentFirstName] AS [First], Users.[Currenttitle] AS Title, Users.[SexCode] AS Gender, Users.[WorkAddressSecondary] AS WorkLocationFROM Users;I appreciate the help. |
 |
|
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2009-08-21 : 21:14:05
|
| ... where CurrentFirstName like @whatThePersonHasTypeedIn+'%'and don't forget to ORDER BY so your TOP clause makes sense. |
 |
|
|
Storm
Starting Member
10 Posts |
Posted - 2009-08-24 : 11:05:04
|
| The below statement didn't work. Am I suppose to replace any words in the statement "@whatThePersonHasTypeedIn+'%'" ?where CurrentFirstName like @whatThePersonHasTypeedIn+'%'and don't forget to ORDER BY so your TOP clause makes sense. |
 |
|
|
|
|
|