How to update form fields based on combo-box value change

  • Thread starter Thread starter SWE
  • Start date Start date
S

SWE

Hi,
I have a form which is based on a complicated query.
I'm using MS Access 2003 and I am try to update the fields of the form
according to a combo-box value change.
I have creaded an event handler using VBA for the (After-update) event that
requery the form as follows:

Private Sub RequestStatusID_AfterUpdate()
Me.RecordSource = (Original query) & "where
CoreStudiesRequestStatus.RequestTestStatusID=" & Me.RequestStatusID "
Me.Requery
End Sub

Note: (Me.RequestStatusID) is the mentioned combo-box

any solution please ?

Regards

SWE
 
I am not good in SQL codes. So i perefer grids most of time.

As data source for your Form, define your complex query by gridview.
In your query, define criteria for column "RequestTestStatusID" as
"Form.RequestStatusID". Close gridview (click yes to save before exit)

And remove RecordSource part from your codes as below.

Private Sub RequestStatusID_AfterUpdate()
Me.Requery
End Sub

It must run.
 
Back
Top