Updating SQL 2005 table via Access 2003 ADP form
Posted on 2008-10-02
Hi all - I recently converted an Access 2003 mdb database to an Access.adp(2003)/SQL 2005 client/server set up. I'm trying to add a new record to an underlying SQL 2005 table via a form in the client side Access.adp database.
The form has a view as its record source, the view is based on a single SQL table and the record in the table has a datetime field.
The form in question displays the current information from the SQL 2005 table and has an Add button on it so when the users wants to add a new record s/he simply clicks on the Add button which executes an After Click event to execute the following function code
Function AddData(frm As Form) As Integer
frm.DataEntry = True
DoCmd.GoToRecord , , acNewRec <====== Error the system is complaining about
frm.CmdEdit.Caption = "&Done"
This code is basically to set up the form - in Edit Mode - ie to allow all fields on the form to be written to -
but unfortunately when this code is executed I get the following message
Runtime error 2105
You can't go to the specified record
and stops on the line of code indicated above..
I have no idea why this is happening BECAUSE I have the same objects (forms, reports, modules etc) in an Access.mdb front end connected to the same SQL 2005 Server database EXCEPT that the SQL tables and views are linked via an ODBC connection and everything works as expected. What am I doing wrong? Surely I'm not the first person on the planet wanting to update an SQL 2005 table via an Access.adp front end form.
I have also noticed that the add record selector (> *) is greyed out when the form is loaded in the Access.adp database but is not greyed out when loaded in the Access.mdb ODBC connected database.
Any thoughts/suggestions as to how I can fix the Access.adp approach would be greatly accepted.