Saving the record in an unbound text box

G

Guest

Hello,

I have a simple form with a text box and a list box. The list box's row
source is derived from a query that finds all records containing the text
that is written in the text box.

The problem is that I can't find out how to update the list box after every
key stroke in the text box. It is clear to me that the content text box needs
to be saved after every key stroke, but so far I have come up short.

I tried using DoMenuItem, but that resulted in the cursor going back ot the
leftmost position after every key stroke, thus basically causing to write
everythingbackwards.

I tried using Me!Refresh, but that made me overwrite the text that was
already in the text box.

So, what I basically need, is something that lets me keep the text that I am
writing, AND that saves the record as I am wrinting it.

Hope this is clear enough.

Thx a lot

Baard
 
G

Guest

Hi bvdahl,

Use the On Change event for the text box, and do the following:

me.LISTBOX.requery

Make sure that your query uses like "*" & forms!FORM.TEXTBOX.text & "*" to
pick up the correct value (the .text on the end is the important bit).

Damian.
 
G

Guest

Thanks,

That worked perfectly. I hadn't put in that .text bit on the end of the
WHERE clause.

Being a bit new to VBA, I had not seen that before. What exatly does it do
(except from making my form work properly, of course)?

Baard
 
G

Guest

Hi Baard,

Sorry, been away a few days so didn't see your post... the .text on the end
forces it to read the text that is currently typed into the control, not what
has been "stored" in the control previously.

Damian.
 

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

Top