Why I am getting the ERROR 2105?

C

Chipcom

Hi

I am getting error 2105 and I don't know why (There are no null
fields).
I use the code:

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
End With


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


Error_Handler:
MsgBox Err.Number
Resume Exit_Here


Any idea why?

Thanks
 
S

Scott McDaniel

Hi

I am getting error 2105 and I don't know why (There are no null
fields).
I use the code:

2105 is, if I'm not mistaken, "You can't go to the specified record" ... if that's the error you're gettings, then are
you sure that you (or someone else) doesn't have this table open?
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
End With


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


Error_Handler:
MsgBox Err.Number
Resume Exit_Here


Any idea why?

Thanks

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
C

Chipcom

2105 is, if I'm not mistaken, "You can't go to the specified record" ... if that's the error you're gettings, then are
you sure that you (or someone else) doesn't have this table open?














Scott McDaniel
scott@takemeout_infotrakker.comwww.infotrakker.com- Hide quoted text -

- Show quoted text -

Hi

I don't know what you mean by table open but I now that the record is
saved in the table and for now I am the only one who use the table.
 
G

Gina Whipp

A couple thoughts...

!WhateverID = Me.txtWhateverID <-- Are you trying to duplicate a primary
key?


And according to Allen Browne's code this appears to be missing a line

!LastName = Me.txtLName
.Update
.Bookmark = .LastModified <---- missing line
End With
 
C

Chipcom

A couple thoughts...

!WhateverID = Me.txtWhateverID <-- Are you trying to duplicate a primary
key?

And according to Allen Browne's code this appears to be missing a line

!LastName = Me.txtLName
.Update
.Bookmark = .LastModified <---- missing line
End With

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors





- Show quoted text -

Hi

Your segestion didn't help to solve the problem.
Do you have any idea how to solve the problem ?
I use the Immediate window and it didn't show me error 2105, just when
it reach the line :
MsgBox Err.Number
I know that I have this error.
From other sub that run the line:
DoCmd.GoToRecord acDataForm, "PaycheckTable", acNewRec
 
G

Gina Whipp

Can you post the entire code as you have it now? Telling me my segment
didn't work doesn't really help me. Also can you share with us exactly what
you are trying to do?
 
C

Chipcom

Can you post the entire code as you have it now? Telling me my segment
didn't work doesn't really help me. Also can you share with us exactly what
you are trying to do?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors





- Show quoted text -

Hi

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:


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


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
 
G

Gina Whipp

And just so that I am clear... you longer get the error 2105, you just know
you have it from other sub line... Can you put a breakpoint on .Bookmark
line and see if the code runs to there? Also, I would like to know how you
know you have this error since you said it no longer shows 2105?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top