I am developing form in MS access. I use SELECT function to load the data to the form. When I am creating a SQL-linked table (External data, ODBC database ..), I am getting error '3146 ODBC -- call failed'. But when I am importing the table with no link to SQL, it works.
Other select functions work with linked table fine.
Dim rs As Recordset
Dim rs_Change_Control As Recordset
CustId = Me.txt_ID.Value
If Len(CustId) > 0 Then
Set rs = CurrentDb.OpenRecordset("SELECT a.key, a.date
FROM (SELECT gnr.key, gnr.date
FROM gnr) a
INNER JOIN (SELECT key, MAX(date) AS maxtime
FROM gnr GROUP BY key) b
ON a.key = b.key AND a.date = b.maxtime WHERE a.key = '123456789';")
If rs.EOF = False Then
Me.txt_ID.Value = rs!key
End if