i would like to know how i could use sql queries in my VB application. i would also like to know which query could be used to sort the values in alphabetical order.
Code: Dim TableSource As String[INDENT]' Tablename from which records are taken[/INDENT]Dim SearchField As String[INDENT]' Field used in the "Where" clause[/INDENT]Dim SearchString As String[INDENT]' Matching string used in the "Where" clause[/INDENT] Dim SearchValue As Integer[INDENT]' For "Where" clause with numeric field.[/INDENT][INDENT]' (Type may be other than Integer)[/INDENT]Dim SortField As String[INDENT]' Field for sorting alpahbetically[/INDENT] Dim SQL As String[INDENT]' This is where we'll put the SQL string[/INDENT] SQL = "Select * from [" & TableSource & "]" SQL = SQL & " Where [" & SearchField & "] Like ""*" & SearchString & "*""" SQL = SQL & " Order by [" & SortField & "]" Data1.RecordSource = SQL Data1.Refresh where Data1 is a Form or Report object