Why I get Error 2105?

Chipcom

Registered User.
Local time
Today, 10:43
Joined
Apr 13, 2006
Messages
63
Hi

I am getting error 2105 and I don't know why, Can you please help me
with that?


The user needs to enter the user name and the password so it inserts
into the database. After that a reference number is created.
Here is the code:


PHP:
Private Sub Form_BeforeUpdate(Cancel As Integer) 


On Error GoTo Error_Handler 
Dim db As DAO.Database 
Dim rst As DAO.Recordset 


      Set db = CurrentDb 
      Set rst = db.OpenRecordset("tblWhatever", dbOpenDynaset) 


      With rst 
          .AddNew 
          !WhateverID = Me.txtWhateverID 
          !FirstName = Me.txtFName 
          !LastName = Me.txtLName 
           .Update 
           .Bookmark = .LastModified 
       End With 


Exit_Here: 
        rst.Close 
        Set rst = Nothing 
        Set db = Nothing 
 Exit Sub 


Error_Handler: 
        MsgBox Err.Number 
        Resume Exit_Here 


Cancel = True 
Exit Sub 


Error_Handler: 
     MsgBox Err.Number 
   Resume Exit_Here 


 End Sub


PHP:
Public Sub Form_KeyPress(KeyAscii As Integer) 


   Dim Erro As Integer 
    '13=Carriage Return 
     If KeyAscii = 13 Then 
On Error GoTo Err_Form_KeyPress 


     DoCmd.GoToRecord acDataForm, "tblWhatever", acNewRec 
Exit_Form_KeyPress: 
    Exit Sub 


Err_Form_KeyPress: 
    MsgBox Err.Description 
    MsgBox Err.Number 
    Resume Exit_Form_KeyPress 


   End If 
End Sub


**Note I am getting the error on MsgBox Err.Number keypress sub and I
don't see the error in the Immediate window.


Thanks
 
Why are you trying to change the record pointer in the keypress event?
 

Users who are viewing this thread

Back
Top Bottom