M
Matthias Claes
Access 2000
I have a form that has a pre-defined parameter query (qry_UserMasterRecord)
set as RecordSource.
The query is expected to select only one single row. (The parameter is set
on the primary key field)
The form has a non data-bound listbox (lbUsers) on it containing possible
values values for the parameter.
(The rowsource is another query on the same table)
I'd like the form to refresh it's contents everytime the users selects a
value in the listbox.
For now, I tried the OnClick event of the listbox, and changing the
parameter's value from VBA:
Private Sub lbUsers_Click()
'select the user in the form's query
Dim qd As QueryDef
Set qd = CurrentDb.QueryDefs("qry_UserMasterRecord")
With qd
.Parameters("[ID:]").Value = Me!lbUsers.Value
End With
Me.Refresh -> data on form doesn't change
Me.Requery -> causes the form the show the parameter dialog
End Sub
I don't get any errors, but the form doesn't refresh it's fields.
I somehow have to find a way to execute the qry_UserMasterRecord query
again, with the new parameter value.
And for the form to refresh the data from the parameter query.
Any help would be appreciated.
Matthias Claes
I have a form that has a pre-defined parameter query (qry_UserMasterRecord)
set as RecordSource.
The query is expected to select only one single row. (The parameter is set
on the primary key field)
The form has a non data-bound listbox (lbUsers) on it containing possible
values values for the parameter.
(The rowsource is another query on the same table)
I'd like the form to refresh it's contents everytime the users selects a
value in the listbox.
For now, I tried the OnClick event of the listbox, and changing the
parameter's value from VBA:
Private Sub lbUsers_Click()
'select the user in the form's query
Dim qd As QueryDef
Set qd = CurrentDb.QueryDefs("qry_UserMasterRecord")
With qd
.Parameters("[ID:]").Value = Me!lbUsers.Value
End With
Me.Refresh -> data on form doesn't change
Me.Requery -> causes the form the show the parameter dialog
End Sub
I don't get any errors, but the form doesn't refresh it's fields.
I somehow have to find a way to execute the qry_UserMasterRecord query
again, with the new parameter value.
And for the form to refresh the data from the parameter query.
Any help would be appreciated.
Matthias Claes