Use query name in Open recordset statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
I have a database that I created which contained all the objects, including
the tabels. I then split the tables out into a back end database and we
enabled user level security. I have a statement in both databases that
looks like this:

rstClients.Open "EmailReminderMedicalVisit", , adOpenKeyset, adLockPessimistic

"EmailReminderMedicalVisit" is the name of a query .

In the non-split, no security database this works fine. In the split,
secured database, I get an error suggesting that Access excepts to see an
actual SQL statment as opposed to the name of a query. In other words,
Access isn't letting me put a query name there. I know it can be done
because it was working in the non-split database. I checked all my library
references in both databases and they identical. I know I'm missing
something. Does anyone know what may be driving this? Thank you very much,
Debbie
 
Hello,
Sorry for the delay in responded - The message I get is :
Runtime error '-2147217900 (80040e14'):
Invalid SQL Statement; expected 'DELETE', 'INSERT', 'PROCEDURE','SELECT', or
'UPDATE'

If I put the actual SQL statement in, it works. I'm stumped. Thanks for
your input.
Debbie
 
adCmdText
adCmdTable
are the constants used to specify whether the value you are passing is a
Table or SQL String

rst.Open "tablename", Options:=adcmdTable
 
Steve,
I tried all the options and either got the same message or I got:
"Microsoft Access cannot find the input table/query
EmailReminderMedicalVisit. Make sure it is spelled correctly or it exists"

I don't understand, it worked fine before I split the database and put the
security on. Any other ideas? Thanks,
Debbie
 
Back
Top