holi4683 holi4683 - 1 year ago 99
SQL Question

Show all time stamps for a date in a list box

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

Answer Source


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


 WHERE ((([Log].[Date Stamp])=[Forms]![Scale_Weight_Log]![LtbDateStamp]))

 ORDER BY Log.[Time Stamp];

Then in vba

 Private Sub LtbDateStamp_Click()


 End Sub
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download