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

VFP7: Auto answer the add record box (form wizard)

Status
Not open for further replies.

cj001

Programmer
Oct 3, 2001
145
US
Hello!

How do I automatically answer the add record box that pops up on a parent-child form created with the form wizard?

I want the box not to show up and automatically be answered with 'Add record to both'.

Thanks!
CJ
 
cj001

I would suggest you override the default code generated by the wizard, by putting your own code in the add button (Word of warning, if you do this it will also break the code for the saving button, which is the same button)

Put NODEFAULT in the add button, now you have disabled the parent code, and on the second line, write your own code to do the add and the save functions.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thank you for responding Mike Gagnon!

I had hoped there would be away to do this without disrupting the form wizard code.

CJ
 
cj001

The other way would be to get the parent code (form the add button from the txtbtns class from the wizbtns.vcx class library) and paste that into your add button in your form and change MS' code to prevent this popup to happen. (More precisely the method to change would be the Addrec method of the commandgroup, at this section (This is the part that bigns up that popup):
Code:
cPapaKey = KEY(m.nPapaKey)
			loAddRec=NewObject("AddRecord",THIS.ClassLibrary,"")
			loCustom = Create('custom')
			loAddRec.cKeyField = m.cPapaKey
			loAddRec.cKeyValue = EVAL(m.cPapaKey)
			loAddRec.oRetValue = loCustom
			loAddRec.Show()

P.S. My suggestion? Do not use the wizard to create forms. The main disadvantage is (as you have discovered), everything is intrinsicely related, and remove one thing, and the rest doesn't work.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thanks again Mike Gagnon.

I'll look into what your suggesting.

Normally I don't use the wizard to create forms. But there have been a couple of cases for testing where the wizard was quicker. I find the pop up very annoying.

CJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top