Hello
I have a tabular form called WorkOutstandingForm, which looks at a query called WorkOutstandingQuery. On the form are two combo boxes (including one called ClientNameCombo) used to filter out certain records from the query.
When I select a client from ClientNameCombo, the other combo box updates based on my selection as intended. However, the rest of the form, i.e. the numerous text boxes, do not update. If I close and reopen the form, then the whole form updates, but I'd like it to update everything without having to open and close.
Here is my code...
Private Sub ClientNameCombo_AfterUpdate()
Dim myQueryDefTemp As DAO.QueryDef
Dim mySQL As String
' Change myQueryDefTemp
Set myQueryDefTemp = CurrentDb.QueryDefs("WorkOutstandingQuery")
mySQL = "SELECT * " & _
"FROM WorkOutstanding " & _
"WHERE ClientName = '" & ClientNameCombo.Value & "' "
myQueryDefTemp.SQL = mySQL
' None of these seem to work!
Forms!WorkOutstandingForm!ClientName.Requery
Me.Refresh
Me.Recalc
Me.Requery
myQueryDefTemp.Close
Set myQueryDefTemp = Nothing
End Sub
I've searched on numerous forums for a solution and everyone seems to suggest Me.Requery, but this doesn't seem to work for me.
Any help would be really appreciated
Thanks
I have a tabular form called WorkOutstandingForm, which looks at a query called WorkOutstandingQuery. On the form are two combo boxes (including one called ClientNameCombo) used to filter out certain records from the query.
When I select a client from ClientNameCombo, the other combo box updates based on my selection as intended. However, the rest of the form, i.e. the numerous text boxes, do not update. If I close and reopen the form, then the whole form updates, but I'd like it to update everything without having to open and close.
Here is my code...
Private Sub ClientNameCombo_AfterUpdate()
Dim myQueryDefTemp As DAO.QueryDef
Dim mySQL As String
' Change myQueryDefTemp
Set myQueryDefTemp = CurrentDb.QueryDefs("WorkOutstandingQuery")
mySQL = "SELECT * " & _
"FROM WorkOutstanding " & _
"WHERE ClientName = '" & ClientNameCombo.Value & "' "
myQueryDefTemp.SQL = mySQL
' None of these seem to work!
Forms!WorkOutstandingForm!ClientName.Requery
Me.Refresh
Me.Recalc
Me.Requery
myQueryDefTemp.Close
Set myQueryDefTemp = Nothing
End Sub
I've searched on numerous forums for a solution and everyone seems to suggest Me.Requery, but this doesn't seem to work for me.
Any help would be really appreciated
Thanks