ALTER USER giving Syntax Error

811 views Asked by At

I'm creating my own form to allow a user to change their password in a Microsoft Access database with user-level security, an *.mdb file. When I run the following VBA code, I get error 3293: Syntax error in ALTER TABLE statement.

CurrentDb().Execute "ALTER USER user PASSWORD NewPassword OldPassword"

I'm following the instructions found in the documentation. How do we change a password through VBA?

1

There are 1 answers

2
HansUp On BEST ANSWER

CurrentDb.Execute is a DAO method, but ALTER USER must be executed from ADO.

Dim strSql As String
strSql = "ALTER USER user PASSWORD NewPassword OldPassword"
CurrentProject.Connection.Execute strSql

CurrentProject.Connection.Execute is an ADO method.