Looking for propriate control event

M

Michalis J.

I have a "customer finder" form with a continous subform. The subform is
connected to a query that narrows down the customers according to the entries
of the textboxes on the main form. When I input the first two letters in the
name textbox on the main form for example (and press enter) the subform is
populated by the cusomers whose name first two letters mach these letters.
This is done by using the after update event of the textbox to requery the
subform.
What I need to do is to requery the subform every time a new letter is typed
in the main's form textboxes without having to press enter. I have tried all
the textbox events with no success. Can anyone give me an advice on that
please?
Thanks in advance

Michalis
 
S

strive4peace

Hi Michalis,

use the Change event and test the .Text property of the control

Warm Regards,
Crystal

*
:) have an awesome day :)
*
 
A

Albert D. Kallal

What I need to do is to requery the subform every time a new letter is
typed
in the main's form textboxes without having to press enter. I have tried
all
the textbox events with no success. Can anyone give me an advice on that
please?


I tend not to like doing this, as it causes a LOT of network traffic if this
application is to be multi-user.

Anyway, just use the on-change event, and since the contents of the control
have NOT yet been updated, you have to use

me.MyContorlName.Text <--- use text in place of "value", or

so, for after update event, you been using

me.MyContorlName.Value
or
me.MyContorlName

Just use the on-change event, and you have to use the .text property of the
control to see the change in the control...
 
M

Michalis J.

Thank you both for your responce. I have tried the .text property but I get
an "Invalid use of property " error. Do I need to set up some reference?

Thanks
Michalis
 
D

Douglas J. Steele

To use the Text property, the control in question must have focus.

In what event have you put your code?
 
M

Michalis J.

I have used the afterupdate event of each textbox in the main form to requery
the subform. This works fine but I need to press "enter " after inputing some
text to the main form controls.
 
D

Douglas J. Steele

AfterUpdate occurs once the data's been saved. I thought you said you wanted
to check as they were typing, not when they finished typing.

Once the data's been saved, the .Text and .Value properties both have the
same values in them.
 
M

Michalis J.

Like I have said in my first posting I have used the afterupdade event but I
have to press enter for the subform to requery. What I want to do is to have
the subform requery every time I type a new letter in any of the textboxes in
the main form. I have tried the onchange event and I have set my.textbox
equal to my.textbox.text and then requery the subform. This works but only
for one letter since the textbox keeps only the last letter I type. This is
probably done because after the event the letter is selected and the next
letter which is typed clears the previous one. Is there a way to move the
cursor to the position to type the next letter programmatically?
 
D

Douglas J. Steele

What you're describing isn't the normal behaviour for the Change event. The
normal behaviour is exactly what you're describing as what you want.

What's the exact code you're trying to use?
 
M

Michalis J.

The code I am using is very simple
Me.Text0 = Me.Text0.Text
Me.CustomerFind.Requery
What I am looking for is a comand to use after that to be able to type
another letter in Text0 before I run the query again as explained in my
previous posting. In this way I will be able to type the first 2-3 or 4
letters of the name of the customer and the subform will keep narrowing down
the matching records.
 
D

Douglas J. Steele

The line of code

Me.Text0 = Me.Text0.Text

is resetting the value of the text box. It serves no useful purpose that I
can see.

What is Me.CustomerFind? If it's a control on the form, what's it based on?
If it's based on a query that refers to Text0, what you're tying in Text0
isn't accessible to it until the AfterUpdate event.
 
M

Michalis J.

The line
Me.Text0 = Me.Text0.Text
sets the value typed in the textbox so that query "CustomerFind" can be
regueried based on this value and the subform populated.
 
D

Douglas J. Steele

As I said, what you're doing is resetting Text0 with that statement, so it's
not surprising that it doesn't work. Try putting a second textbox on the
form (make it hidden so that it doesn't bother anyone <g>), write the value
of Me.Text0.Text to that second textbox, and base the query on the second
textbox, not Text0.
 
B

bijou

parler francais
Douglas J. Steele said:
AfterUpdate occurs once the data's been saved. I thought you said you
wanted to check as they were typing, not when they finished typing.

Once the data's been saved, the .Text and .Value properties both have the
same values in them.
 

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


Top