AfterUpdate 2007 Question

mjreiman

Registered User.
Local time
Today, 09:29
Joined
Jan 29, 2010
Messages
25
I am using access to do a timesheet database for work. I simply have a table with the fields TimesheetID(PK), WeekEnding, Day, HoursWorked, Paid. I just imported the data from an excel spreadsheet then made a query with all the fields included. I then made a form with a combo box displaying the WeekEnding dates with DISTINCT unbound. Then I put a list box to display the rest. I can't remember the coding for the AfterUpdate to populate the list box and the one I found was
Private Sub cboWeekEnding_AfterUpdate()
Me.lstData1.RowSource = "SELECT TimesheetID, WeekEnding, Day, Hours " & _
" FROM qryTimesheet" & _
" WHERE WeekEnding = " & Me.cboWeekEnding & _
" ORDER BY TimesheetID"
End Sub
but it doesn't work. I set the criteria for WeekEnding in the query as [Forms]![frmTimesheetView]![cboWeekEnding] but that makes the form come up blank so I removed it. And yes the control source for the form is set to qryTimesheet. So I removed the [Forms] statement and the afterupdate command doesn't seem to want to work. Nothing happens.

Please help
Thanks,
Matt
 
Hi,

Try Me.lstData1.Requery after changing the rowsource...

Simon B.
 

Users who are viewing this thread

Back
Top Bottom