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

VFP SQL - form edit problem

Status
Not open for further replies.

b98mr1

Programmer
Feb 23, 2005
20
GB
I am running a foxpro database with a SQL Server backend. On one of my forms, when I edit a record and then save I get the message:

"Data has been changed by another user. Overwrite changes with your edits?."

This form has a local view with a full join between two tables that are remote views.

I am stumped as to what is causing this alert. Any help would be greatly appreciated....
 

Are the update criteria set in the local view? You have to specify in the view that if the data has changed, what fields you want to update.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Yes all the required fields are set to update and the send SQL Updates checkbox is ticked.
 

b98mr1,

This is exactly what you would expect when you get a multi-user collition. Are you saying that the message is wrong -- that another user has not edited the record in question?

The behaviour is controlled by the "Update Where" settings on the Update Criteria page. You can avoid ever seeing the message by setting this to "Key fields only", but are you sure that is what you want? It means that you will never detect multi-user collisions (except where the other user has deleted the record).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
That is it exactly. I am the only one editing the record and therefore cannot understand as to why this alert appears.

I do need to detect multi-user collisions so I set the "Update Where" settings to Key and modified fields and "Update using" SQL Update.

As far as I know, the tables and views have been set up correctly. This problem only started to appear when I created a local view of two tables that reside on the server. These tables have a full join as I need to see multiple records on both tables that share a common factor......
 

b98mr1,

I am the only one editing the record and therefore cannot understand as to why this alert appears.

In that case, I agree something is wrong. You shouldn't see this message.

This problem only started to appear when I created a local view of two tables that reside on the server. These tables have a full join as I need to see multiple records on both tables that share a common factor......

You don't need to use a local view for that. Why not just use a single remote view, which joins the tables in question? I'm not saying that will solve the problem, but since the problem only arose when you added the local view, it would make sense to eliminate it.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Thanks Mike for your input so far.

I originally had a remote view with two tables. However once this view was created, I was unable to modify the Query, receiving the alert "Unable to modify query" which is why I created the local view.

Apart from this edit problem, I am able to view the record's details on the form ok and even transfer the details from one database to another.

I am thinking that there may be a problem with my version of FoxPro (which is version 8)??



 

No, I don't think it's a problem with VFP 8.0. If that version had any particular problems with remote views, it would be generally known.

I think you would do better trying to sort out the original "unable to edit this view" problem. When exactly did the problem arise? Was it in the view designer, or at run-time?

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
The problem arose at run-time. I was able to create the local view without any problems and the data is visible through this. I have a variety of controls on my form and this problem occurs in all.

I have also tried various classes as the edit control but this made no difference.

I'm at a loss....
 

Sorry, I've run out of ideas. The only thing I can suggest is that you try to update the view independently of the form -- in the command window, perhaps. That'll remove any side effects caused by controls or code on the form. If it works, add it to a plain form with nothing else on it, then build up the form there.

I still think you should stick to the original two-table remote view rather than using a local view, but I could be wrong.

If all else fails, perhaps you should consider doing the updates via SQL pass-through. Keep the view, but use SQLEXEC() to send the UPDATE statements.

Let us know if any developments.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Just a WAG, but are the Remote Views fields set to be Updateable?

I agree with Mike that you should go back and find out what the problem was with the Remote Views as it may well be affecting your Local View.

Good luck!
Jim
 

I encountered this message recently, and I noticed that one of my forms had a default datasession and the other had a private datasession. I sent them both to default datasession and the problem went away.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Thanks for all your help guys.

My remote views are set to be updateable. I have removed the local views which caused the error msg but I am still having trouble with creating a parent-child relationship.

Mike, I have checked the datasession property of my forms and all are set to default. I have not found any major differences in properties between the forms.

Still scratching my head at this one....

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top