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

Clearing/Resetting Form

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I would like to reset/clear my form to bring it back to the way it is after it is first opened. For example, I have radio buttons and combo boxes that are initially empty. After I use the form and store my data I would like to bring it back to its original state. How is this done? Thanks for your help.

Thanks,
David
 
Hi David!

You can use control property DefaultValue. On control properties window set controls DefaultValue. You can use following function for setting of controls DefaultValues:

private sub cmdReset_OnClick() 'CommandButton
call DefaultCtlValues(me)
end sub


Sub DefaultCtlValues(frm as form)
dim ctl as control

on error resume next 'If is wrong control property (ctl.DefaultValue)
for each ctl in frm.controls
if ctl.defaultvalue<>&quot;&quot; and _
not isnull(ctl.defaultvalue) then
ctl=ctl.DefaultValue
end if
next ctl
end sub


Also you can use Tag property instead DefaultValue

Aivars
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top