Field updating when I dont want it to.

G

Guest

I have a form with a subform. I am doing a requery on a list box in the main
form based on the input in an object in the subform. The object's text
length must be greater than 3 to requery the list box. My problem is when I
requery the list box in the main form the object in the subform updates. I
dont want this. What is happening is when I requery the listbox the OnExit
(ie saying I am exiting the object) in the subform is processing.

I have another form/subform doing the same thing but the object does not
update when the listbox is requeried.

I have looked at the code and put stops in the code and cannot find why in
the form I am having a problem with that it is saying I am exiting the object
(and therfore updating the object's value) when I requery the list box in the
main form.

What might be causing this? Thank you for your help.

Steven
 
J

John Vinson

I have a form with a subform. I am doing a requery on a list box in the main
form based on the input in an object in the subform. The object's text
length must be greater than 3 to requery the list box. My problem is when I
requery the list box in the main form the object in the subform updates. I
dont want this. What is happening is when I requery the listbox the OnExit
(ie saying I am exiting the object) in the subform is processing.

I have another form/subform doing the same thing but the object does not
update when the listbox is requeried.

I have looked at the code and put stops in the code and cannot find why in
the form I am having a problem with that it is saying I am exiting the object
(and therfore updating the object's value) when I requery the list box in the
main form.

What might be causing this? Thank you for your help.

Steven

Please post your code. Note that requerying a Form requeries all its
objects including subforms!

John W. Vinson[MVP]
 
G

Guest

I can see now why it works as desired in one form and not the other. In the
form it works ok there is no Link Child Fields / Link Master Fields set.
When I deleted the LCF / LMF on the form I am having a problem, then it
worked ok. But for this form I have to have the LCF / LMF set.

What I am doing for example is: In the subform account object the user
types for example a "c" then an "a" then a "s" and on change I have MyVar =
"*" + Nz(Me.Account) + "*" and because the len of MyVar is greater than 4 the
listbox in the main form will be set to visible and requery showing Like
*cas* accounts for selection. Then the cursor highlights the entire field in
the Account Object in the subform. In the other form it automatically will
sit at the end of the text because there is not a LCF / LMF set but when they
are set it highlights the entire characters in the object.

How can I force it to not highlight the entire object after the requery but
put the cursor at the end of the text ready to accept the next keystroke?

Thank you for your help.
 
G

Guest

Problem solved.

Instead of using a listbox on the main form where the form has a LCF / LMF,
I used another subform an made it a continuous sheet and used the same query
as the Data Source. By doing this I am able to continue progressive
keystrokes in the Account Textbox and then requery the new lookup subform
with the desired results. Bottom line here is it appears that if you have a
LCF / LMF and you requery an object on the main form you will also update the
subfom. Basically like what you said in your response.

Thanks,

Steven
 

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