Run-Time Error 2105 (1 Viewer)

HealthyB1

Registered User.
Local time
Tomorrow, 00:37
Joined
Jul 21, 2013
Messages
96
G'day,
I am running access 2007 in Win7. I have a time sheet application that I wrote many years ago. Within same I have a button to press to open a new form to enter time sheet data. The data for the form comes from a query that links Employee and the Timesheet history data file.

In an effort to upgrade and make the application more portable and available to multiple users, I decided to migrate the data tables to a Microsoft SQL 2012 database.

Various Access reports based on the SQL database run ok. But if I try to open a form to add a new record I get the following error message:-
"Run-Time Error '2105' You can't go to the specified record."


If I debug the error it shows:-
Private Sub
Form_Open(Cancel As Integer)
DoCmd.GoToRecord , , acNewRec
End Sub


In an effort to make sure the original time sheet form load worked ok on the original tables, I changed the query to feed off tables in the local Access program and have no issues. It works perfectly. Also if I open the Timesheet Query that feeds the form I can add new records.

However if I change the Query to look at the same tables on the SQL database I cannot add records. I can search all records from first to last but not add a record into the query. The add record arrow is greyed out on the query results.

I assume that the problem must be with the access to SQL but I am not sure where to go looking next.
Any suggestions would be greatly appreciated.

:confused:
 

GinaWhipp

AWF VIP
Local time
Today, 10:07
Joined
Jun 21, 2011
Messages
5,901
Just to be sure I am understanding, the query which is the RecordSource of the Form does accept new records, correct? And if you open that RecordSource you see you have ability to add new records. correct?
 

HealthyB1

Registered User.
Local time
Tomorrow, 00:37
Joined
Jul 21, 2013
Messages
96
Hi Gina,
I went and checked and found that one of the SQL tables (tblTimesheets) did not have a primary key set. As a result I could not add records to the table in the SQL database.
Also it would not let me assign a primary key as there were duplicate records. Further investigation resulted in finding several records with duplicate data.
A lesson learned for me. :eek:
SQL is much more stringent than bare bones access.
Thank you ever so much. :)
 

HealthyB1

Registered User.
Local time
Tomorrow, 00:37
Joined
Jul 21, 2013
Messages
96
Wow thanks ever so much. Some reading for tomorrow.
It's 2:00am here so I'm off to bed.
Once again thanks heaps.
Cheers
 

Users who are viewing this thread

Top Bottom