I have a search option and the field where the search criteria goes into keeps changing from a string to numeric
If I activate the Order No, the second field from the right changes the caption to Order No. and then the last field (cmbFilter) is where the user places in the value. In this case the input mask makes the uswer start entering data from the left in the cmbFilter.
I do this for the Supplier and no problem and for a date it reverts to the user being forced to enter the date value from the right hand end of the field, or I try and
use the Order No option and I have to enter the data from the right hand side of the cmbFilter field
The panel with the radio buttons is named OptionsFrm and the After Update event is
-------------------------------------
The cmbFilter field afterUpdate event is
What can I do to make sure the cmbFilter field stays as a string field
Any help will be a bonus
If I activate the Order No, the second field from the right changes the caption to Order No. and then the last field (cmbFilter) is where the user places in the value. In this case the input mask makes the uswer start entering data from the left in the cmbFilter.
I do this for the Supplier and no problem and for a date it reverts to the user being forced to enter the date value from the right hand end of the field, or I try and
use the Order No option and I have to enter the data from the right hand side of the cmbFilter field
The panel with the radio buttons is named OptionsFrm and the After Update event is
Code:
Private Sub OptionsFrame_AfterUpdate()
Dim bolVisible As Boolean
Dim strSource As String
bolVisible = (Me.OptionsFrame > 0)
With Me.cbmFilter
'.Visible = bolVisible
Select Case Me.OptionsFrame
Case 1
strSource = "select OrderNo from OrdersOnlyQry group by OrderNo Order By OrderNo;"
Me.FilterLbl.Caption = "Order No"
Me.FilterLbl.Width = 1248
Me.cbmFilter.InputMask = "00000;0;"
sFilter = "OrderNo = 'p1'"
Case 2
strSource = "select Supplier from OrdersOnlyQry group by Supplier Order By Supplier;"
Me.FilterLbl.Caption = "Supplier"
Me.FilterLbl.Width = 1248
Me.cbmFilter.InputMask = ""
sFilter = "Supplier = 'p1'"
Case 3
strSource = "select DateOrdered from OrdersOnlyQry group by DateOrdered Order By DateOrdered;"
Me.FilterLbl.Caption = "Date Ordered"
Me.FilterLbl.Width = 1450
Me.cbmFilter.InputMask = ""
sFilter = "DateOrdered = #p1#"
Case 4
strSource = "select DateArrived from OrdersOnlyQry group by DateArrived Order By DateArrived;"
Me.FilterLbl.Caption = "Date Arrived"
Me.FilterLbl.Width = 1361
Me.cbmFilter.InputMask = ""
sFilter = "DateArrived = #p1#"
Case Else
' ------------ should not get here --------------------------
MsgBox " Using the default Order No. Option"
strSource = "select OrderNo from OrdersOnlyQry group by OrderNo Order By OrderNo;"
Me.FilterLbl.Caption = "Order No."
Me.FilterLbl.Width = 1248
Me.cbmFilter.InputMask = "00000;0;"
sFilter = "OrderNo = 'p1'"
End Select
.RowSource = strSource
End With
If oldValue <> Me.OptionsFrame Then
Me.cbmFilter = ""
oldValue = Me.OptionsFrame
Me.FilterOn = False
End If
End Sub
-------------------------------------
The cmbFilter field afterUpdate event is
Code:
Private Sub cbmFilter_AfterUpdate()
Dim thisFilter As String
If Len(Me.cbmFilter & vbNullString) > 0 Then
thisFilter = Replace(sFilter, "p1", Me.cbmFilter)
Me.Filter = thisFilter
Me.FilterOn = True
Me.Requery
Else
Me.FilterOn = False
End If
End Sub
What can I do to make sure the cmbFilter field stays as a string field
Any help will be a bonus