Database Problems in VB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gvloenen
    New Member
    • Nov 2006
    • 13

    Database Problems in VB

    I have an Access database that is connected to VB where I can select my record through a combo box

    The records are restaurant informatioin for different cities. I want to be able to view only some records at a time. For example i need to somehow program that if I put Toronto in a textbox or select it from another combo box, that i will only see records that have toronto as the listed city.

    Also, How do i make my entries alphebetical order

    I am very new at VB and am using 2005 Express

    Any suggestions
    Thanks,
    GREG
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    It sounds as though you need to insert a WHERE clause (filtering/selection) and an ORDER BY clause (sorting) into the SQL you're passing to Access.

    How is the database connected to your application now?

    Wherever the record source is specified (data control?) I think you can simply overwrite the string there with an SQL statement. Here's a very simple example of the sort of SQL I mean.
    Code:
    SELECT * FROM [YourTable] [B]WHERE[/B] [City] = 'Los Angeles' [B]ORDER BY[/B] [City];
    The idea, of course, is that you will use the value from your text box or whatever to set up this string first.

    Comment

    Working...