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

Requery Combo Box Issue

Status
Not open for further replies.
Nov 22, 2007
38
GB

Hi

I have combo box on a form called SourceID and a command button that opens the Frm_Source if a user needs to add a new record.

when the Frm_Source form is closed the SourceID Combobox doesn't refresh? My current code is:

Code:
Private Sub Cmd_AddSource_Click()
    DoCmd.OpenForm "Frm_SourceClaim", acNormal
    DoCmd.GoToRecord , , acNewRec
    Me.SourceID.Requery

I've tried putting the openform as a dialog but this then refreshes the whole form and sets me on a new record?

Thanks for any pointers

Ralph
 
You may try this:
DoCmd.OpenForm "Frm_SourceClaim", acNormal, , , acFormAdd, acDialog
DoEvents
Me!SourceID.Requery

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
ralphralph07 . . .

So you understand, your code keeps running asychronously with opening of the form! [blue]PHV's[/blue] suggestion opens the form [purple]modal[/purple] (your code stops running until [blue]Frm_SourceClaim[/blue] is closed) . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Hi
I've just retested the code and it does refresh the combobox but doesn't keep on the record that the user was inputting - it jumps to a new record or a previous record.

How can i ensure that when I close form that the main form doesnt change record?

This is the code:

Code:
    DoCmd.OpenForm "Frm_ClientSingle", acNormal, , , acFormAdd, acDialog
    DoCmd.GoToRecord , , acNewRec
    DoEvents
    Me!ClientID.Requery

Thanks for all the help

Ralph
 
Get rid of this line:
DoCmd.GoToRecord , , acNewRec

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top