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

Set Focus

Status
Not open for further replies.

EllieFant

MIS
May 15, 2001
513
0
0
US
Hi,

I have a form (upReadingRequirements) with 4 list boxes and a subform. When I click on the last listbox (DocNumList) I want to have the focus set to the DRead field on my subform (subfrmReadDocUpdate). How do I do this? Right now the On Click event is me.refresh.

Thanks for your help.
Ellie
**Using Access 97**

lena.wood@wgint.com (work)
elliefant@starband.net (home)
 
By not getting an answer, does this mean it can't be done? Ellie
**Using Access 97**

lena.wood@wgint.com (work)
elliefant@starband.net (home)
 
have you tried this:



DRead.setfocus

in the DocNumList_LostFocus action?
"The greatest risk, is not taking one."
 
This works only if I click out of the DocNumList box. I was hoping to be able to click on a document number and have it go to the DRead field of my subform. Just trying to save a few mouse clicks. Especially when I am entering 100's of documents.
Ellie
**Using Access 97**

lena.wood@wgint.com (work)
elliefant@starband.net (home)
 
what document number?
"The greatest risk, is not taking one."
 
In addition to Raymondo's suggestion, you can handle it from the query that provides the report's recordset.

Open the query in design view, select the key field (the one that will distinguish the record in both the form and report) and then set its critieria to:

Forms!YourFormName!ControlName

The control name will be for the control (text box, listbox, combobox) that is bound to the key field.

The report will now only show records related to the form's current record.

Cheers, Bill
 
Hi,
Put the following code in the On Click event of the list box:

Dim ctrl as control
Me.Refresh
Set ctrl=[Forms]![subfrmReadDocUpdate].DRead
ctrl.SetFocus
Set ctrl=Nothing

Try this and let us know what happens. I have not tried this out with sub forms.
 
The way to access a control on a subform from the main form is

Me!Subform1.Form!ControlName Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top