neillovell
Programmer
Hi,
Note: My database is on a network.
I have a form that accesses a query, which returns the rows from a table where LogonName equals the name of the user logged in to the database ( using CurrentUser() ). I saved the form as a data access page which works as I'd expect when you click on it directly (i.e. not running access), the messagebox appears asking for the user name and password to enter the database, however it does not understand CurrentUser().
The SQL statement that's causing the problems is
WHERE (((ADMINRecordsTable.LogOnName)=CurrentUser()) AND ((ADMINRecordsTable.Date) Between Date()-"14" And Date()));
NOTE: sorting the last few records by date is a new addition and is not the cause of the problem.
I am told that the "data provider failed when executing a provider command" and "CurrentUser() is an undefined function".
HOWEVER if I change CurrentUser() to something like 'neil-lovell' the data access page works perfectly. It just does not understand what CurrentUser() means for some reason. If I open the page from inside access (i.e. start up access rather than double clicking the data access page file) it works perfectly.
Has anyone encountered this?
Note: My database is on a network.
I have a form that accesses a query, which returns the rows from a table where LogonName equals the name of the user logged in to the database ( using CurrentUser() ). I saved the form as a data access page which works as I'd expect when you click on it directly (i.e. not running access), the messagebox appears asking for the user name and password to enter the database, however it does not understand CurrentUser().
The SQL statement that's causing the problems is
WHERE (((ADMINRecordsTable.LogOnName)=CurrentUser()) AND ((ADMINRecordsTable.Date) Between Date()-"14" And Date()));
NOTE: sorting the last few records by date is a new addition and is not the cause of the problem.
I am told that the "data provider failed when executing a provider command" and "CurrentUser() is an undefined function".
HOWEVER if I change CurrentUser() to something like 'neil-lovell' the data access page works perfectly. It just does not understand what CurrentUser() means for some reason. If I open the page from inside access (i.e. start up access rather than double clicking the data access page file) it works perfectly.
Has anyone encountered this?