G
Guest
why does my combo box show the date that is in the field (as it should) but
if in the field the date is 12/08/2005 (this is how it will display in the
cbo box) why do no records show but if i enter 08/12/2005 in the cbo box it
will... this also works vice versa...
if in the field the date is 12/08/2005 (this is how it will display in the
cbo box) why do no records show but if i enter 08/12/2005 in the cbo box it
will... this also works vice versa...
Code:
Private Sub Form_Load()
' Populate the cbo with order dates where On Order is greater than 0
Me.cboOrderDate.RowSource = "SELECT OrderDate " & _
"FROM tblOrderCurr " & _
"WHERE OnOrder>0 AND OrderDate>#01/01/1900# " & _
"GROUP BY OrderDate " & _
"ORDER BY OrderDate;"
' Me.cboOrderDate.Value = Me.cboOrderDate.ItemData(0)
If Me.cboOrderDate.Value <> "" Then
Me.frmsubOrderCurr.Visible = True
Call cboOrderDate_AfterUpdate
Else
Me.frmsubOrderCurr.Form.RecordSource = ""
Me.frmsubOrderCurr.Visible = False
End If
End Sub
----------------------
Private Sub cboOrderDate_AfterUpdate()
On Error GoTo ErrorHandler
Me.frmsubOrderCurr.Form.RecordSource = "SELECT CartridgeName, " & _
"OnOrder, PricePerUnit, TotalCost FROM tblOrderCurr " & _
"WHERE OrderDate = " & "#" & Trim(Me.cboOrderDate.Value) & "#"
Me.frmsubOrderCurr.Form.Refresh
ErrorHandler_Exit:
Exit Sub
ErrorHandler:
MsgBox ("Error #: " & Err.Number & "; Description: " & Err.Description)
Resume ErrorHandler_Exit
End Sub