sql connectivity

kishgan's Avatar, Join Date: Feb 2007
Newbie Member
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.
ever_thus's Avatar, Join Date: Jan 2007
Dim TableSource As String
' Tablename from which records are taken
Dim SearchField As String
' Field used in the "Where" clause
Dim SearchString As String
' Matching string used in the "Where" clause
Dim SearchValue As Integer
' For "Where" clause with numeric field.
' (Type may be other than Integer)
Dim SortField As String
' Field for sorting alpahbetically
Dim SQL As String
' This is where we'll put the SQL string
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