Results 1 to 4 of 4
  1. #1
    Vanita is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Feb 2019
    Posts
    23

    Search Multiple Data Using Split form

    I have 3 fields for search
    1. Combo box which is operator name
    2.From Date
    3.To Date


    I have written code and attached form image below which is not working.Please help me to solve this problem.

    Code:

    Private Sub BtnSearch_Click()
    Call SearchBtn
    End Sub
    Sub SearchBtn()
    Dim strCriteria As String
    Dim task As String
    Me.Refresh
    If IsNull(Me.Operator) Or IsNull(Me.Fdate) Or IsNull(Me.Tdate) Then
    MsgBox "Please Enter the Required Date", vbInformation, "Date Required"
    Me.Fdate.SetFocus


    Else
    strCriteria = "(([Operator_Name])<=#" & Me.Operator & "# And ([Production_Date])>=#" & Me.Fdate & " # And ([Production_Date])<=#" & Me.Tdate & "#)"
    task = "Select * from Operator_Efficiency_Query where (" & strCriteria & ") Order By [Production_Date]"
    DoCmd.ApplyFilter task
    End If
    End Sub
    Click image for larger version. 

Name:	Capture.JPG 
Views:	15 
Size:	67.7 KB 
ID:	38530

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Try :
    strCriteria = "(([Operator_Name])<='" & Me.Operator & "' And ([Production_Date])>=#" & Me.Fdate & " # And ([Production_Date])<=#" & Me.Tdate & "#)" (# are for dates, single quotes ' or double double quotes "" are for wrapping strings in VBA expressions.


    Cheers,
    Vlad

  3. #3
    Vanita is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Feb 2019
    Posts
    23
    Thank You..Its Working..

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Great to hear!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. How to create a search box in split form?
    By Jeremy Sng in forum Modules
    Replies: 8
    Last Post: 03-15-2017, 05:22 AM
  2. Search on Split-Form
    By Ekhart in forum Programming
    Replies: 8
    Last Post: 09-07-2016, 10:55 AM
  3. Replies: 1
    Last Post: 04-09-2015, 05:13 PM
  4. Replies: 4
    Last Post: 04-29-2014, 04:33 AM
  5. Replies: 12
    Last Post: 03-22-2012, 02:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums