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

How to empty the textbox in subform when click NEW button?

Status
Not open for further replies.

sallyGals

Programmer
Feb 1, 2006
35
DE
i have one subform in my main form,so what should i do if when i click NEW button,i want the subform's textbox to be empty?

subform name is frmDailySup,it contains of these field name:
cboShift,cboSupervisorName1,cboSupervisorName2,txtDirectHeadcount,cboIndirectHeadcount

i had try to put frmDailySup.cboShift.setfocus, but it cant work ,it shows a msgbox " object require".

thank you for your kindness help.
 
Your question pertains to "textbox to be empty" but then your code attempts to set focus to a control. What is your actual question?

To set the focus to a control on a subform, you may need to first set focus to the subform control:
Me.frmDailySup.SetFocus
Then set focus to a control on the subform.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
i had try Me.frmDailySup.SetFocus also,but it do not work,it show an error msg: data or method do not founded
i put this code in my mainform's NEW button,is it correct?
 
Maybe you should tell us what you want to accomplish.

Normally we give our main forms names that begin with "frm". You suggest your frmDailySup is a subform control. Is this correct?

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top