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

After requery of subform, record moves to previous record 1

Status
Not open for further replies.

tlcurry

Programmer
May 11, 2011
3
US
I am in desperate need of some help.

I have a parent form that collects ticket/daily work information(Header information).

In the parent form, the user must select from a drop-down, the customer. After selecting the customer, I requery a drop-down on the subform to select equipment that is assigned to the customer. The subform collects detail data i.e. labor hours, equipment used etc.

When I click in the subform, it immediately takes me to the previous record. If I began data entry on record #36, select the customer, click in the subform for record #36, I am taken to record #35.

Any thoughts?
Thanking you in advance. Ugh...
 
Just to test, after selecting the customer, click in another control in the header, NOT the subform.... THEN after you've clicked the other control, try clicking something in the subform.

Do you get the same issue then?

If not, it's b/c of the timing of when the After_Update or whatever other event you're using of the customer combo box is firing.
 
Thanks for your response.

I gave your suggestion a shot and it still went back to the previous record. If I leave the current record and move to the next record, then back, it doesn't do this.

Humm.....I'm stress and stumped. Just can't think anymore.

Any thoughs on the "firing" order?

I sure appreciate it. :)
 
How are ya tlcurry . . .
tlcurry said:
[blue]If I began data entry on record #36, select the customer, click in the subform for record #36, I am taken to record #35.[/blue]
Sounds like some other code is running when you select the subform ... or your subform is not synchronized with the mainform. Can't pin this down until more info from you.

Is the subform linked with [blue]master/child[/blue] properties?

You say you requery the [blue]equipment combo[/blue]. But thats all! Nothing else happens to the subform from what you've explained ... as far as navigation is concerned. Yet you quote [blue]navigation[/blue] changes things in the subform. If I'm right ... you need to find the event that puts you on the previous record. Let us know!

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Thank you for your help. Instead of requering the subform in the header, I used repaint.

I set the requery of the subform in the gotfocus event of both combo boxes.

Thank you again. Works very well! :)
 
I sometimes have to swap between repaint, refresh, requery, or recalc in testing to get everything right. Then again, after doing that many times in recent history, I think I'm getting a better standing of which one fires when, does what.. Of course, if I'd just pick up a reference book, I'd probably find it in a list... I know I've played with a sample database before, some time back, that demonstrated when the various events took place on a form.
 
You should use Refresh instead of, or in conjunction with Repaint. Requery, if executed on the form (i.e. Me.Requery) causes the form to display the first record in the recordset. Executing it on the control itself, i.e. Me!SomeComboBox.Requery should just cause the combo to refresh it's recordset.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top