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

TableUpdate not working if record is at end of file...

Status
Not open for further replies.

badscots

Programmer
Dec 23, 2003
19
GB
Hello all,

I have a view that has an update trigger. If the user modifies a record, and then exits the application, it automatically saves and displays a message box "Auto save complete". This works fine unless its the very last record in the table Im updating...

Any thoughts???

IanMc.
 
Hello Mike,

I was trying to do the following:

If the user modifies a record in the view and then closes the application, it would activate a method to tell the user it had been saved (with a tableupdate). I'd noticed that if a user changed a field but didnt move the cursor position and closed the app it did not save the changes.

I have the update criteria set to "SQL Update".

The trigger is just a 'if you reached the minimum quantity' clause.

I have also noticed that if I change the Update criteria to "SQL Delete and Insert" it keep the changes if the user exits.

Now Im completely stumped!!!

I just want to be able to save all the changes...

Which route do you think I should take...except to the pub!!!

TX's

IanMc.
 
Ian,

I'd noticed that if a user changed a field but didnt move the cursor position and closed the app it did not save the changes

If you are using row buffering, that situation should give rise to an error saying that there are still uncommitted changes in the buffer (I think).

The trigger is just a 'if you reached the minimum quantity' clause.

So are you saying that the trigger is immaterial? Have tried removing the trigger to see if the problem disappears? (Come to think of it, how can you have a trigger with a view?)


if I change the Update criteria to "SQL Delete and Insert" it keep the changes if the user exits.

Wait a minute. Are we talking about local views or remote views? If local views, I can't see how that option would make a difference. If remote views, it would depend on the back end.

Mike



Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Hello Mike,

Oh dear what have i started....

The trigger is on the base table of the view in the forms grid. It basically calls a PRG and checks if (stock.qty)<=(stock.min_order), if so it sends an email to the stock controller.

I am using a local view and set the update criteria to "SQL Delete and Insert". This seemed to get over the problem I was having with the last record in the table being updated (crashing out) dont ask me how???

I think I was calling routines after the user hit "Exit" and the objects were unloaded. Ive put a routine in the release event to check the user updates before shutdown. Im testing this at the mo...seems to work so far.

Would the Release event be the best place to do a 'tidy-up' routine before the form releases ie enables me to call other methods in the form before exit?

TX's

IanMc



 
Ian,

I am using a local view and set the update criteria to "SQL Delete and Insert". This seemed to get over the problem

That's the thing I really don't understand. But if it solves the problem, who am I to argue <g>.

Would the Release event be the best place to do a 'tidy-up' routine before the form releases ie enables me to call other methods in the form before exit?

I normally put that sort of stuff in QueryUnload, mainly because it will get called automatically when the user closes the form, or closes the app, or even closes Windows. Within QueryUnload, you can issue NODEFAULT to prevent the from from closing down.

The only slight problem with that is that QueryUnload doesn't get automatically called when you close the form programmatically. You would have to call it explicitly in those cases.

Sorry I can't be more help.

Mike





Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Hello all,

Thanks for your tips...

I think Ive fixed it...

It seems that I needed the View and base table's buffer mode set the same. Dont ask me why? But when they were different it didnt work.

Cheers 4 now.

IanMc.
 
You shouldn't be using any buffering on the source table in most cases. If you do, you have to issue a TABLEUPDATE on BOTH the view and the source table.


-BP (Barbara Peisch)
 
Hello Barbara,

Thanks for the valuable advice, that's exactly what Im doing. I will take it on board that the base table of a view should have a default buffer mode set?

TX's everyone...

IanMc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top