Originally Posted by
OwlMan
Hi All
I am a teacher who has to teach my class a small amount of VB programming, however programming is not my strong point, hence my need for help. In previous years I have taught them a password routine for Access. It is a very simple routine: a password is entered in to a form and if it is correct then the switchboard opens. The code has always worked in Access 2003 but our establishment has now switched to 2010 and the code no longer works. The problem seems to be with the SetFocus section of code. The code I am using is as follows:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("select * from tblPassword where password = '" & Text0.Value & "'")
If rs.EOF Then
MsgBox ("Incorrect Password. Please Try Again")
Else
Form_Switchboard.SetFocus
DoCmd.Close asForm, "frmPassword"
End If
I would be very grateful if someone could advise me what the problem is with the highlighted line of code. As I said, this always worked fine in 2003.
Many thanks