runtime error 2105 (1 Viewer)

gizmogeek

Registered User.
Local time
Today, 00:04
Joined
Oct 3, 2007
Messages
95
I didn't create this .accdb. I've been asked to help fix the error but when I open the .accdb it gives me error 2105 upon opening it. I've tried decompile/compile (grayed out), compact and repair (which does nothing).

Any/all help will be appreciated.
 

boblarson

Smeghead
Local time
, 21:04
Joined
Jan 12, 2001
Messages
32,068
2105 means you can't go to that record.

So, if you have a macro or VBA which is attempting to move to a new record and it is already on a new record, then that error can occur. You can put in error handling to stop that or you can fix the code that is doing it.
 

gizmogeek

Registered User.
Local time
Today, 00:04
Joined
Oct 3, 2007
Messages
95
Can you tell me how to fix it. It's been a long time since I've worked with MS Access. When I hit debug on the error it just shows me
Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec

End Sub
 

boblarson

Smeghead
Local time
, 21:04
Joined
Jan 12, 2001
Messages
32,068
You can fix by using:

Code:
Private Sub Form_Load()
[B][COLOR=red]If Not Me.NewRecord Then[/COLOR][/B]
   DoCmd.GoToRecord , , acNewRec
[B][COLOR=red]End If[/COLOR][/B]

End Sub
 

gizmogeek

Registered User.
Local time
Today, 00:04
Joined
Oct 3, 2007
Messages
95
Thanks Bob! However, I still get the same error and if I run debug it still stops on DoCmd.GoToRecord , , acNewRec
 

boblarson

Smeghead
Local time
, 21:04
Joined
Jan 12, 2001
Messages
32,068
Thanks Bob! However, I still get the same error and if I run debug it still stops on DoCmd.GoToRecord , , acNewRec
Is your DATA ENTRY property set to YES by chance? If so, you can delete that go to record code (with the other part I gave you as well).
 

gizmogeek

Registered User.
Local time
Today, 00:04
Joined
Oct 3, 2007
Messages
95
Hey Bob baby steps. How do I check the data entry property and will I need all of the code you sent or just go back to the old after I delete the "yes"

Thanks!!
 

boblarson

Smeghead
Local time
, 21:04
Joined
Jan 12, 2001
Messages
32,068
Hey Bob baby steps. How do I check the data entry property and will I need all of the code you sent or just go back to the old after I delete the "yes"

Thanks!!
1. Open the form in Design View.
2. Go to the Properties and on the DATA tab, look for DATA ENTRY.


You would delete the entire code for the Load event.
 

gizmogeek

Registered User.
Local time
Today, 00:04
Joined
Oct 3, 2007
Messages
95
Okay. There is nothing in the properties but I did delete the entire code and it opens without error.
 

gizmogeek

Registered User.
Local time
Today, 00:04
Joined
Oct 3, 2007
Messages
95
Shouldn't it open to a blank sheet where I can put in new data? I don't see anywhere to add new.
 

gizmogeek

Registered User.
Local time
Today, 00:04
Joined
Oct 3, 2007
Messages
95
Now when I open it I can go into properties. Before it wouldn't come up in this view it would just come up with blank properties. The data entry is set to "No".
 

gizmogeek

Registered User.
Local time
Today, 00:04
Joined
Oct 3, 2007
Messages
95
Yes, it was set to "No" already only I couldn't see the full properties until I took the code out. Now it opens without error and I do see records in the form but nowhere to put in new.
 

boblarson

Smeghead
Local time
, 21:04
Joined
Jan 12, 2001
Messages
32,068
Yes, it was set to "No" already only I couldn't see the full properties until I took the code out. Now it opens without error and I do see records in the form but nowhere to put in new.
Ah, then your form's RECORD SOURCE may not be Updateable. Check to see that you can modify any existing records.

And if you can modify them, make sure that the form's ALLOW ADDITIONS property is set to YES (also located on the DATA tab of the properties).
 

gizmogeek

Registered User.
Local time
Today, 00:04
Joined
Oct 3, 2007
Messages
95
Okay. I can't modify the records. Allow Additions is set to "YES"

Here is the code on the record source: SELECT Clients.*, [Attachment].FileName FROM Clients;
 

boblarson

Smeghead
Local time
, 21:04
Joined
Jan 12, 2001
Messages
32,068
It's a table.
So the only thing I can think of is that the Attachments field is causing you the problem. What happens if you take that out of your record source? Does the form update/add records then?
 

gizmogeek

Registered User.
Local time
Today, 00:04
Joined
Oct 3, 2007
Messages
95
Do I take out just the word Attachments or the whole select statement?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom