Scunningham99
Programmer
Hi All
I have a label on my ms access form whereby i would like to execute a command to run SQL on click event.
Dim mydb As Database 'database
Dim myrs As Recordset 'table to search
Dim TableSource As String
Dim searchfield As String
Dim searchstring As String
Dim SQL As String
Set mydb = CurrentDb
TableSource = "tblcompany"
searchfield = "[Customer Forename]"
searchstring = "Mary"
'put conditions in where clause for search criteria set to variables
SQL = "Select * from " & TableSource
Set myrs = mydb.OpenRecordset(SQL) 'table to read from"
End Sub
I CANNOT GET THE ABOVE TO RUN/COMPILE WHEN I CHANGE TO '*' FOR A COLUMN NAME. SUCH AS REPLACING IT WITH SEARCHFIELD IE & "[" & searchfeld "]" &
Any help would be greatly appreciated!!
I WOULD LIKE TO POSSIBLE POBULATE THE RESULTS IN TO TEXT BOXES ON FORM!
I have a label on my ms access form whereby i would like to execute a command to run SQL on click event.
Dim mydb As Database 'database
Dim myrs As Recordset 'table to search
Dim TableSource As String
Dim searchfield As String
Dim searchstring As String
Dim SQL As String
Set mydb = CurrentDb
TableSource = "tblcompany"
searchfield = "[Customer Forename]"
searchstring = "Mary"
'put conditions in where clause for search criteria set to variables
SQL = "Select * from " & TableSource
Set myrs = mydb.OpenRecordset(SQL) 'table to read from"
End Sub
I CANNOT GET THE ABOVE TO RUN/COMPILE WHEN I CHANGE TO '*' FOR A COLUMN NAME. SUCH AS REPLACING IT WITH SEARCHFIELD IE & "[" & searchfeld "]" &
Any help would be greatly appreciated!!
I WOULD LIKE TO POSSIBLE POBULATE THE RESULTS IN TO TEXT BOXES ON FORM!