Setting focus

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

After hitting enter on the "Ok" command button on the form a report is
opened, then I close the report, the form is cleared, but the focus is still
on the "Ok" key. How do I get the focus to go the first tab order field
after hitting the enter key on the "Ok" command button.
 
After the command to print the report, set the focus to the desired field

Docmd.OpenReport "ReportName"
Me.[FieldName].SetFocus
 
Dalaw,
Do that before opening the report.
DoCmd.GoToControl "OrderField"
DoCmd.OpenReport.......
 
report name = canquote
field name = cancon

so is it written like this?
docmd.OpenReport "canquote" me.cancon.setfocus

What does this "me" do?

Ofer said:
After the command to print the report, set the focus to the desired field

Docmd.OpenReport "ReportName"
Me.[FieldName].SetFocus

--
\\// Live Long and Prosper \\//
BS"D


dalaw said:
After hitting enter on the "Ok" command button on the form a report is
opened, then I close the report, the form is cleared, but the focus is still
on the "Ok" key. How do I get the focus to go the first tab order field
after hitting the enter key on the "Ok" command button.
 
Try

docmd.OpenReport "canquote"
me.cancon.setfocus

The Me stand for the current form where the button is located on, so instead
of writing
Forms![FormName]![cancon].SetFocus

you can write
me.cancon.setfocus

As long that this control name on the current form
--
\\// Live Long and Prosper \\//
BS"D


dalaw said:
report name = canquote
field name = cancon

so is it written like this?
docmd.OpenReport "canquote" me.cancon.setfocus

What does this "me" do?

Ofer said:
After the command to print the report, set the focus to the desired field

Docmd.OpenReport "ReportName"
Me.[FieldName].SetFocus

--
\\// Live Long and Prosper \\//
BS"D


dalaw said:
After hitting enter on the "Ok" command button on the form a report is
opened, then I close the report, the form is cleared, but the focus is still
on the "Ok" key. How do I get the focus to go the first tab order field
after hitting the enter key on the "Ok" command button.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Conditional Formatting 2
"Enter" key behavior 2
Lost Focus ! 4
SetFocus not working 2
Command Button Wizard 2
Set Focus 1
Close on Lost Focus 2
Open SubForm help 2

Back
Top