refreshing a field on a tab on a form

grapevine

Registered User.
Local time
Today, 21:49
Joined
Feb 21, 2009
Messages
39
I have a form (frminputupdatecourseinfo) that has four tabs on it. On the first tab (Enrolment Info) I have a combo box that is referencing a lookup table (tblSubject).

I have set this field (subjectiD) so that if the subject does not exist in the drop down list the user can double click to access another form (frmSubject) where the subject can be added. frminputupdatecourseinfo remains open whilst this update takes place.

From looking at other posts I believe that I need to refresh the combo box on frminputupdatecourseinfo before the additional subject will show in the combo box and I have entered the following code in the onclose event of frmSubject

Private Sub Form_Close()
Forms!frminputupdatecourseinfo!SubjectID.Refresh
End Sub

I believe something is wrong with the syntax of my coding as I get the following error when I try and close the frmsubject after adding a record. (The record is added and if I close and reopen the frminputupdatecourseinfo the new record does show)

Runtime error 438 Object does not support the object or method and the Debug highlights my forms line. Do I need to somehow reference the tab and if so how? Or am I on the wrong track completely?

Any assistance gratefully received.
Many thanks
Marion:confused:
 
As far as I know, Refresh only update existing records the current recordset. You will need to use Requery to get he new record.

Try:
Code:
Forms!frminputupdatecourseinfo.SubjectID.Requery
 
What a SuperStar!

Many thanks, this now works a treat.

Much obliged for your time.
Marion
 

Users who are viewing this thread

Back
Top Bottom