Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with acFormAdd

Status
Not open for further replies.

speja01

Programmer
Dec 15, 2010
8
US
Hi Everyone,I am in desperate need of some assistance from the experts here. I'm working on a project to convert an existing application from Oracle 8.1.7 to DB2 9.7 on windows. The application has a MS Access 2000 front end. The current implementation on Oracle works fine.

Here is the issue I am coming across with DB2:I have a main form named "frmItemUpdate" that has a query for a recordset which retrieves data from table a. There is a subform named "subFrmItemRequiredData" on the main form which also has a query for a recordset which goes against the same table as the main form. One of my modules issues the following command:

DoCmd.OpenForm "frmItemUpdate",,,,acFormAdd

From what I understand, this command is suppose to open the form to a new blank record. When I debug this using the Oracle backend, the Form_Load event of the subform is the first event to occur after the command above is executed. When I debug using the DB2 backend. the first event to occur is the Form_Open event on the main form. If I remove the acFormAdd argument, it behaves just like the Oracle implementation by going to the Form_Load event of the subform. For the life of me I can't figure out why the DB2 implementation is behaving differently when the acFormAdd argument is used. The table both queries are executing against has a primary key defined. Can someone explain to me what exactly the acFormAdd argument is doing to the underlying table involved in the query? Is it trying to insert a blank row in the underlying table? Is this a limitation in regards to using DB2 linked tables compared to Oracle? Any help would be appreciated. I have spent several days trying to figure this out and feel like I haven't made any progress.Thanks
 
Are you sure the DB2 query is returning an updateable record set? If it is returning a "snap shot" or read only recordset, the acFormAdd will fail. Go to the record source property, open it in a query window, and execute it. You should get the record set returned. Look at the bottom of the table window. If you can add a new record, you've got an updateable recordset. If you can't DB2 is returning you a snap shot. That means your issue is going to be with your ODBC driver or how ever else you are connecting with the back end.

 
Thanks vbajock...I tried what you suggested and I was able to add a new record so it appears DB2 is returning an updateable recordset.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top