A) My db has a table called single that stores metadata. single always has one row. Each field in it functions like a global variable.
B) I have a function in a module. The purpose of the function is to determine whether a connection with our sql server is available. This function has three commands.
The first command deletes all of the rows in a test table.
The second command calls a DTS package in SQL Server. That package should put one row into the table.
The third command runs a query that uses dcount() to determine whether the table contains records. The third command's syntax is "DoCmd.OpenQuery ("setConnected")".
Here is the query's syntax:
UPDATE [single] SET [single].connected = IIf(DCount("pk","checkConnection")=1,True,False);
note
k is an autonumber field. so it can never be null.
C) If I comment out the third line, run the function, and then run the update query manually, everything works PERFECTLY.
D) If I uncomment the third line and run the function, dcount does not function properly. It returns zero even if checkConnection contains a record. This is inexplicable and terribly frustrating.
B) I have a function in a module. The purpose of the function is to determine whether a connection with our sql server is available. This function has three commands.
The first command deletes all of the rows in a test table.
The second command calls a DTS package in SQL Server. That package should put one row into the table.
The third command runs a query that uses dcount() to determine whether the table contains records. The third command's syntax is "DoCmd.OpenQuery ("setConnected")".
Here is the query's syntax:
UPDATE [single] SET [single].connected = IIf(DCount("pk","checkConnection")=1,True,False);
note
C) If I comment out the third line, run the function, and then run the update query manually, everything works PERFECTLY.
D) If I uncomment the third line and run the function, dcount does not function properly. It returns zero even if checkConnection contains a record. This is inexplicable and terribly frustrating.