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

docmd.requery closes form!! why?

Status
Not open for further replies.

scottian

Programmer
Jul 3, 2003
955
GB
i am trying to requery a form from another form after data has been updated. but when i click the close button i also have
"Forms![TestingSchedule].DoCmd.Requery", but this doesnt work. instead of requerying the data it closes the form.
does anyone have any ideas.
ive also tried "Forms![TestingSchedule].Requery" but i get the same problem

"My God! It's full of stars...
 
Hi scottian, please code you post your code behind the button. Might be something as simple as the order of your code.
 
my code is

Private Sub Close_Click()

Forms![TestingSchedule].DoCmd.Requery
DoCmd.close
End Sub

"My God! It's full of stars...
 
How are ya scottian . . . . .

Change:
Forms![TestingSchedule].DoCmd.Requery
To:
Forms!TestingSchedule.[purple]Requery[/purple]

cal.gif
See Ya! . . . . . .
 
I think you'll have to put the close statement before the requery statement.

Private Sub Close_Click()

DoCmd.close
Forms![TestingSchedule].Requery

End Sub

It sounds like the form you are trying to requery is getting the focus and the close statement then closes it.

Or

You could be more specific in the close statement and use:

DoCmd.Close acForm, "(form name)", acSaveYes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top