Hello,
I do not know why I am getting the run-time error '3061': Too few parameters. Expected 1.
Below is the code I wrote. I renamed the table and the columns to general terms. The "dbo" table is a SQL Server table that is linked through the Linked Table Manager in Microsoft Access. All connections from the Microsoft Access frontend to the SQL Server backend database are working. The error message occurs on the strSQL when it is used in the dbs.OpenRecordset statement.
Private Sub Form_Load()
Dim dbs As DAO.Database, rst As DAO.Recordset, strSQL As String
Set dbs = CurrentDb
strSQL = "SELECT [dbo_table].[field1],[dbo_table].[field2] FROM [dbo_table]"
Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset)
Set Forms("frmABC").Recordset = rst
End Sub
As a point of interest, when I change the above code to use only one column, such as [dbo_table].[field1], the code executes without any errors.
If anyone can solve the issue, it would be most appreciated.
Thank you.