Hello there everyone, thank you in advance for any help you may have to offer here. I have a seemingly simple request to help me finish off this db for a customer.
I have looked everywhere high and low for a sample that allows a user to input two integers in two different input boxes, and have a vb script filter a query based on those two fields.
I am very new to Access, and am having a hell of a time trying to make what SQl does in its sleep
But I would really really appreciate some help form the community on this.
I willa ttach below my feeble attempt at getting this to work using the >= expression but I just cant seem to figure it out.
To clarify,
I have built a small DB for them to enter various job related information. One of the tables is called Job. I would like to have
search_a (text box in my form) &
search_b (another text box)
create a result of all records equal to or less than search_b.
All job numbers are a 5 digit number with no letters to confuse the issue. The query is called job_3, which pulled all the numbers in the Job column from the main table.
I am again VERY new to access and am grateful for any help.
I have looked everywhere high and low for a sample that allows a user to input two integers in two different input boxes, and have a vb script filter a query based on those two fields.
I am very new to Access, and am having a hell of a time trying to make what SQl does in its sleep
Code:
SELECT * FROM shippingtable WHERE zip_code between search_a and search_b
I willa ttach below my feeble attempt at getting this to work using the >= expression but I just cant seem to figure it out.
Code:
Option Compare Database
Option Explicit
Private Sub cmdFilter_Click()
Dim strWhere As String 'The criteria string.
Dim lngLen As Long
If Not IsNull(Me.Job) Then
strWhere = strWhere & "([job] = " & Me.searcha >= Me.searchb & ")"
End If
End Sub
Private Sub cmdReset_Click()
'Purpose: Clear all the search boxes in the Form Header, and show all records again.
Dim ctl As Control
'Clear all the controls in the Form Header section.
For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next
'Remove the form's filter.
Me.FilterOn = False
End Sub
Private Sub Command152_Click()
'Purpose: Clear all the search boxes in the Form Header, and show all records again.
Dim ctl As Control
'Clear all the controls in the Form Header section.
For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next
'Remove the form's filter.
Me.FilterOn = False
End Sub
Private Sub Form_BeforeInsert(Cancel As Integer)
'To avoid problems if the filter returns no records, we did not set its AllowAdditions to No.
'We prevent new records by cancelling the form's BeforeInsert event instead.
'The problems are explained at http://allenbrowne.com/bug-06.html
Cancel = True
MsgBox "You cannot add new clients to the search form.", vbInformation, "Permission denied."
End Sub
Private Sub Form_Open(Cancel As Integer)
'Remove the single quote from these lines if you want to initially show no records.
Me.Filter = "(False)"
Me.FilterOn = True
End Sub
I have built a small DB for them to enter various job related information. One of the tables is called Job. I would like to have
search_a (text box in my form) &
search_b (another text box)
create a result of all records equal to or less than search_b.
All job numbers are a 5 digit number with no letters to confuse the issue. The query is called job_3, which pulled all the numbers in the Job column from the main table.
I am again VERY new to access and am grateful for any help.
Comment