G
Guest
Realtively new to Access programming, so bear with me. I have a database on a
server with one linked table (through the Link table wizard). I am trying to
run a query using a parameter passed from a form. I am struggling to get it
to work, and even switched from ADO to DAO. The code is below. Any
suggestions appreciated.
'Defining the recordset and setting connection
Dim dbs As Database
Dim rs As DAO.Recordset
Dim strSQL As String
Set dbs = CurrentDb
'Define SQL string for the RS
strSQL = "Select tblNamesExtensions.[Manager], "
strSQL = strSQL & "tblNamesExtensions.[First Name], "
strSQL = strSQL & "tblNamesExtensions.[Last Name], "
strSQL = strSQL & "tblNamesExtensions.[Extension], "
strSQL = strSQL & "tblNamesExtensions.[VM Password] "
strSQL = strSQL & "From tblNamesExtensions "
strSQL = strSQL & "Where tblNamesExtensions.[Manager] = '" &
Me.Manager & "'" & ";"
Set rs = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
server with one linked table (through the Link table wizard). I am trying to
run a query using a parameter passed from a form. I am struggling to get it
to work, and even switched from ADO to DAO. The code is below. Any
suggestions appreciated.
'Defining the recordset and setting connection
Dim dbs As Database
Dim rs As DAO.Recordset
Dim strSQL As String
Set dbs = CurrentDb
'Define SQL string for the RS
strSQL = "Select tblNamesExtensions.[Manager], "
strSQL = strSQL & "tblNamesExtensions.[First Name], "
strSQL = strSQL & "tblNamesExtensions.[Last Name], "
strSQL = strSQL & "tblNamesExtensions.[Extension], "
strSQL = strSQL & "tblNamesExtensions.[VM Password] "
strSQL = strSQL & "From tblNamesExtensions "
strSQL = strSQL & "Where tblNamesExtensions.[Manager] = '" &
Me.Manager & "'" & ";"
Set rs = dbs.OpenRecordset(strSQL, dbOpenSnapshot)