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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem updating form data bound to a Stored Procedure

Status
Not open for further replies.

jjme88

Programmer
Dec 28, 2007
58
GB
I have a problem where by I have some quite complicated sql server 2000 stored procedures that I want to bind to an adp form in Acccess. All is fine I can return the recordset and bind the fields to the form and the data displays.

I do this via setting the 'Record Source' to the stored proc and setting the 'input paramters'

The problem I have is that the records are not updateable which I can understand. I get the message "The field XYZ is bassed on an expresion and can't be edited"

What I would like to do is having got the records displayed is allow them to be edited... all be it disconeted from the underlying records and then via a 'Save' button grab any changes a user makes and apply them back to the database.

Does that make sense to anyone.. can anyone sugest a method for doing this???
 
Rather than binding the fields, you can write the data to each field. Let us say that each control has the same name as each field:

Code:
For i=0 To rs.Fields.Count-1
  Me(rs.Fields(i).Name)=rs.Fields(i)
Next

You can use a similar method to check for changes and to write back to the database.

Have you seen:
msdn.microsoft.com/archive/en-us/dnaraccess/html/msdn_harness.asp
 
Will this work if I have multiple records in a continous form??
 
Sure would. You can only update one record at a time on a form whether they are continuous or single view.

ProDev, Builders of Affordable Software Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
I can't quite see how it would work when writing to a continuous form, however, you could provide a pop-up edit form.
 
Hmmm im confused as to where to put the code??

I have my recordset retrieved as part of the onload event and now have all my controls unbound with matching names to the database but i cant think where to put the code so that each row matches up.

sorry if thats a silly question!
 
As I said, I cannot see how it would work with a continuous form. The code would go in the current event of a single form. If you use the current event of a continuous form, all control will show the same data.
 
I'm sorry, I overlooked the part about using the iteration process to load the values as well as update. No, this will not work for the loading of data on a continuous form. Just the updating. And you would put that in an update button.

ProDev, Builders of Affordable Software Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top