NetTalk Central

Author Topic: How do I change Insert form to change form  (Read 4790 times)

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
How do I change Insert form to change form
« on: March 22, 2010, 03:40:52 PM »
Hi All,

After a form opens in insert record mode I want to add the record and change to change record mode.

I have added the following to the preinsertafterprimes embed but if I click ok on the form it wants to insert the record again. Is there another SSV I need to change or is even what I am trying to do possible?

Cheers,

Kevin

Access:POTRN.UseFile()
If Access:POTRN.Insert()
  Message('Unable to Insert POTRN')
End
p_web.SetSessionValue('POPurchaseOrderEntryForm_CurrentAction',Net:ChangeRecord)
loc:action = p_web.site.ChangePromptText
loc:act = Net:ChangeRecord

Poul

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: How do I change Insert form to change form
« Reply #1 on: March 23, 2010, 06:51:12 AM »
WAG: On Save, When inserting -"Insert Another"  -- on your updateform?

FWIW - i have done something like this where i embed my insert, but come into the form in Change mode.

Would be interested to know if you can easily flip loc:act...   


kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: How do I change Insert form to change form
« Reply #2 on: March 23, 2010, 03:11:53 PM »
On save I return to the Browse.

I have thought about coming in as change mode but that means I would have to add my own insert and change buttons to the browse and I'm trying to avoid that at the moment as it is a big app.

I think I need the wisdom of Bruce to know if there is an easy way to do this...

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: How do I change Insert form to change form
« Reply #3 on: March 24, 2010, 03:29:56 AM »
Hi Kevin,

the correct thing to so is return the new action from the PreInsert routine.
(you can also change the action in PreUpdate and preDelete)

To change the action set ans = newaction, ie in your case
ans = net:ChangeRecord

The rest (should be) automatic.

cheers
Bruce



kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: How do I change Insert form to change form
« Reply #4 on: March 24, 2010, 06:10:53 AM »
Thanks Bruce. Do I need to change Loc:Action and Loc:Act or just changing the ans will clean this up?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: How do I change Insert form to change form
« Reply #5 on: March 25, 2010, 06:01:06 AM »
I think just changing ans. Keep us posted...

cheers
Bruce