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!

requery not working

Status
Not open for further replies.

zzzqqq

Programmer
Oct 12, 2005
17
IE
Hi,
I'm relatively new to VB and Microsoft Access. I currently have difficulty with the requery function. I'm trying to reload a textareas on the load event of a form. Here is the code
Private Sub Form_Load()
Me.Refresh
DoCmd.Maximize
Me.NoOfRec = Me.lstSearch.ListCount

Me.txtStartDate = Me.txtStartDate2
Me.cmbStartDate.Value = Me.txtStartDate2
Me.cmbEndDate.Value = Date
Me.txtEndDate = Date
Me.lstSearch.Requery

End Sub
This unfortunately doesn't work as it's not maintaining updates when I re-enter the page. Anyone have any ideas here or alternative solutions. The query I am calling is quite complex involving 3-4 tables.
Cheers,
Mark.
 
What do you mean by "... re-enter the page ..." exactly?

A Form_Load runs only when the form is first loaded and not when it is already loaded and just gets focus back from some other form.

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
If you're hiding the form or just switching to another, you should use the Form.GotFocus event. As Golom said, you only get one shot at a first impression...errr...load :) Unless of course you unload the form, but then you have to rebuild your list so that's probably not what you want.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top