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

combo boxes

Status
Not open for further replies.

Allilue

Technical User
Sep 14, 2000
189
0
0
GB
i have a combo box that when i select a record, displays the corresponding subform on a form. the following is the code that does this:

Private Sub cboCostCentre_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[CostCentre] = '" & Me![cboCostCentre] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

however, i would like to add a component to "goto" a specific field once the subform is displayed. currently, the focus goes to the first field by default. [sig][/sig]
 
one quick method would be to change the Tab Index Setting to 0 for that control that you want to Set Focus to.

PaulF [sig][/sig]
 
Ok, I set the Tab Index to 0 for the form. But I want focus on a specific field within the subform. currently, i am able to set focus on the subform...but how to go to a specific field? under tab selection, i can only choose subform, and nothing within. i also went to the subform itself, and this has no option for tab index setting. [sig][/sig]
 
In your procedure, before exiting try using:
Code:
forms![Formname]![subformname]![fieldname].setfocus

hope this helps.. [sig]<p>Phooey<br><a href=mailto:Andrew.j.harrison@capgemini.co.uk>Andrew.j.harrison@capgemini.co.uk</a><br>Otherwise known as Windy Bottom.[/sig]
 
Hi Allilue,

try

Private Sub cboCostCentre_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst &quot;[CostCentre] = '&quot; & Me![cboCostCentre] & &quot;'&quot;
' shiftfocus to subform
YourSubForm.setfocus
' find a match
Me.RecordsetClone.FindFirst &quot;[aField] = '&quot; & aValue & &quot;'&quot;
Me.Bookmark = Me.RecordsetClone.Bookmark
' goto the field
thefield.setfocus

end sub

HTH
Robert



[sig][/sig]
 
Thank you. That works fine. Now I was also wondering...
How come when I have a field that is highlighted, I get something that looks like a combo box, but there are two arrows that point away from one another. it's like there is an option to view info that can't be seen in current view. However, all the text is limited to 8 characters, so there would be no additional hidden text underneath.
Sorry that I can't explain what I need too well. I don't know what these &quot;things&quot; are called....

Thanks! [sig][/sig]
 
HI,

Are you sure that field is not a memo field? What you describe is how a memo field looks on a form. [sig][/sig]
 
no. it's a text field. it's happening to all fields that i select. i guess it's not really a problem. i just don't know how to get rid of it!

also, for that same field (of the subform), some comments are going to be input that expand to more than the size of the current box. i changed the properties to &quot;can grow&quot; and &quot;can shrink&quot;, but when in form view, i still can't see the entire comment. i can't even scroll down to see the remainder of the comment. i have to use the right arrow to scroll. is there another way to fix this? [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top