Help with requery (1 Viewer)

Prysson

Registered User.
Local time
Today, 23:05
Joined
Sep 23, 2002
Messages
45
I have a form which has a list box with four buttons.

The list box is based on a query and it displays a list of possible Training Systems.

The Add button obviously represent different command structures.


Now if the user click on Add a small form opens up with a blank field. The user enters data (new trellis type) and click the ok button. This closes the pop-up form and returns to the add training system for…for structure sake lets name them appropriately

frmEditTrainingSystem (Main Form)
frmAddTrainingSystem (The pop-up form)
cmdAddTrainingSystem (the Add button on the Main form)
cmdOKAddTrainingSystem (the Ok button on the pop-up form)


So Seqentially what happens is that you click on Add and the Event Procedure for say “on Click” open the frmAddTrainingSystem. Now the frmAddTrainingSystem form has a nifty little feature in the “on open” that reads as follows

Private Sub Form_Open(Cancel As Integer)


DoCmd.GoToRecord , , acNewRec


End Sub

This as you can see immediately adds a new record to the Training Systems folder. The user can then enter the data into the field and clicking on OK closes the form which should “Activate” the previous form…what I would like to do is at some point in the sequence add an event procedure to requery the data present in list box so that when you close the frmAddTrainingSystem form the new training system is displayed in the list box.

For simplicity sake lets call the query that the list box uses as a row source is called qryTrainingList. I have tried placing the following

Private Sub Form_Activate()

Me.Requery

End Sub

In the On Activate Event but it does no good.

Any suggestions.
 

Rob.Mills

Registered User.
Local time
Today, 18:05
Joined
Aug 29, 2002
Messages
871
I'm guessing that the form that you have the listbox in is an unbound form. If that's the case then there is nothing to requery for the form. You need to set the requery property on the listbox itself.

Me.lstName.Requery
 

Rob.Mills

Registered User.
Local time
Today, 18:05
Joined
Aug 29, 2002
Messages
871
Oops... wrote that syntax wrong.

Me!lstName.Requery
 

Users who are viewing this thread

Top Bottom