Link to home
Start Free TrialLog in
Avatar of Canders_12
Canders_12Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Access 2007 - Subform refresh fun

Hello all,

I would like to refresh a subform on a form every time I enter a letter of someones surname into a textbox.  If I use the "me.refresh" command everything works a treat. However, it selects the textbox and highlights all of the text so when the user goes to enter the second letter of their search it overtypes the first one.  Ideally I would just like the subform refreshed each time a key is pressed in the textbox mentioned above, if it is possible?

Form is: frmStaffToTask
Subform is: frmMemberAreaDetails
Textbox is: txtSurnameQuickSearch

Any help would be appreciated, many thanks in advance, Alan.

PS

I have a workaround which keeps the me.refresh and then sets focus of the textfield and then goes to the end of the textfield but it just does not feel clean.
Avatar of GRayL
GRayL
Flag of Canada image

I guess I'm wondering why you do not use a combo box with the autocomplete property set on?  Can you explain why the subform?
Avatar of Canders_12

ASKER

this subform is a complex pivot which will not be able to be recreated in a combo box.

Many thanks, Alan.
If you can specify a field in a recordset for a text box, you can do the same thing for that field in a combo box.
GRayL:

It is not a standard recordset.  It is a subform, which is a pivot and not a standard for, that is linked to a query.  If you need evidence I can upload the database but am still keen to understand how I can do as previously asked as I feel I will need this for future forms.

Many thanks, Alan.


In an unbound textbox on my form I entered this code:

Private Sub tbxTableName_Change()
  MsgBox Me.tbxTableName.Text
End Sub

Every time i entered a letter I got a message containing the letters type to that point.  I think you should use the Change() event of your subform's textbox to 'process' your data - note there is no refresh required.
GRayL:

I am sorry, I have obviously not explained myself clearly.  Whatever is in that textbox is what is driving the query that is driving the subform pivot.  Therefore I need the subform to refresh as the textbox field is being updated letter by letter.

Many thanks, Alan.
ASKER CERTIFIED SOLUTION
Avatar of MINDSUPERB
MINDSUPERB
Flag of Kuwait image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Many apologies all,

A personal family issue has meant all projects went on hold.  I appreciate all your responses and will be going with the MindSuperb options.

Once again, many apologies, Alan.
Useful solution to difficult problem.