I have data entered in a table multiple times a day with a date stamp and a time stamp, along with other info. I have 2 fields to filter, primary is day and the other is time. I also have a form with 2 listboxs, the one i want to show the dates and no duplicates. The other i want to display all the time stamps under that day after a day is slected from the first listbox. How do i do this in access? Is it the same as vba in excel or sql?
The following Code runs but doesnt do anything:
Private Sub ltbDates_Click() [ltbFiltered].RowSourceType = "Table/Query" [ltbFiltered].RowSource = "SELECT Time_Stamp, Layer, Status, Weight, CDI FROM Scale Weight Log " & _ "WHERE Date_Stamp = '" & ltbDates.Value & "'" End Sub
Advertisement
Answer
Solved:
Created a query named filtered.
SELECT Log.[Time Stamp] AS Expr1, Log.Status, Log.[Layer Count] AS Expr2, Log.[Part Count] AS Expr3, Log.Weight FROM Log WHERE ((([Log].[Date Stamp])=[Forms]![Scale_Weight_Log]![LtbDateStamp])) ORDER BY Log.[Time Stamp];
Then in vba
Private Sub LtbDateStamp_Click() ltbFiltered.Requery End Sub