Go Back   Access World Forums > Microsoft Access Discussion > General

 
Reply
 
Thread Tools Rating: Thread Rating: 6 votes, 5.00 average. Display Modes
Old 08-03-2007, 08:56 PM   #1
Chipcom
Registered User
 
Join Date: Apr 2006
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Chipcom is on a distinguished road
Question Why I get Error 2105?

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 Code:
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 Code:
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

Chipcom is offline   Reply With Quote
Old 08-04-2007, 04:05 AM   #2
RuralGuy
AWF VIP
 
RuralGuy's Avatar
 
Join Date: Jul 2005
Location: @ 8300' in the Colorado Rockies
Posts: 13,820
Thanks: 7
Thanked 310 Times in 300 Posts
RuralGuy is just really nice RuralGuy is just really nice RuralGuy is just really nice RuralGuy is just really nice RuralGuy is just really nice
Why are you trying to change the record pointer in the keypress event?
__________________
(RG for short) aka Allan Bunch Previous MS Access MVP acXP, ac07, ac10, ac13 - WinXP Pro, Win7 Pro, Win10 Pro
Please post back to this Forum so all may benefit.
Teaching is not filling a bucket but lighting a fire.
RuralGuy is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump




All times are GMT -8. The time now is 05:45 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World