On 5 Oct, 15:17, deejayquai <deejayq...@gmail.comwrote:
On 5 Oct, 15:10, Tom van Stiphout <no.spam.tom7...@cox.netwrote:
On Fri, 05 Oct 2007 13:23:24 -0000, deejayquai <deejayq...@gmail.com>
wrote:
Don't use a reserved word like Form as a variable name.
No need to MsgBox your variable. Use the debugger.
Listboxes are readonly. If you want to update them, the procedure is
to update the underlying RowSource with an Update query, and then
requery the listbox so the changes will show.
-Tom.
>Hello
>Simple one this I guess, but I'm quite stuck at the moment.
>I would like to update the records displayed in my listbox
>(lstStudents) using criteria selected from my combo (cboForm) in a
>form.
>My basic code is:
>Private Sub cboForm_AfterUpdate()
>Dim Form As String
>Form = cboForm.Column(1) 'A simple list of all the available forms
>lstStudents.Column(7) = Form 'This is the relevant column in the
>underlying query that lists the student's form
>End Sub
>I've tried declaring the variable as a variant too but all I keep
>getting is Error 424 object required. I've msgbox'd my variable and
>it is correct but it can't be used as the appropriate criteria for the
>listbox. Help!
>many thanks
>David- Hide quoted text -
- Show quoted text -
Thanks, but don't go away- how do I update the underlying rowsource
with an update query...! (sorry)
David- Hide quoted text -
- Show quoted text -
Actually, I need to apologise- I think I may have described my problem
incorrectly- what I would like to do is requery the list box based on
the selection I make in the combo- I don't want to change any of the
underlying data itself. So for example if I choose form 'E' from the
combo then the listbox autmatically requeries to only show students in
form E. The listbox has 8 columns- name, age, form etc so I'm trying
to use the combo to filter the listbox accordingly- sorry for the
confusion. I'm still stuck though.
David