View Single Post
  #25  
Old February 8th, 2005, 12:35 AM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Mon, 07 Feb 2005 23:25:50 GMT, wrote:


They all have it! What is the code I shouild use to replace it?


Backup your database.

Open the Form.

Click the Code button or click the ... icon by one of the controls to
open the VBA editor.

Erase ALL of the code - everything! - by clicking Ctrl-A (Select All)
and then clicking the Delete key.

Close the VBA editor; click the ... icon by the AfterUpdate event of
txtStudentID, which is - I'm assuming, change the name if I'm wrong -
the name of the UNBOUND textbox.

Copy and paste this into the VBA editor, REPLACING the two lines with
Sub and End Sub which Access will provide for you:

Private Sub txtStudentID_AfterUpdate()
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone ' get the form's list of records
rs.FindFirst "[Student ID] = '" & Me!txtStudentID & "'"
If rs.NoMatch Then ' see if this ID exists
MsgBox "Check this card, this ID was not found", vbOKOnly
Else
Me.Bookmark = rs.Bookmark ' open the found student's record
End If


I have no idea how you got events on every single control on the form
- but you certainly do NOT want them there!

John W. Vinson[MVP]