Avatar of Ernest Grogg
Ernest Grogg

asked on 

Better Search Form

Been trying to improve upon my search form and well, I have a sample here but can't get it working correctly

I have the main form with 2 subforms

The main form has the search criteria, the first subform is in Datasheet view.  The apply filter applies it to the datasheet subform.  I have it set that if you select the record and double click it should open that record in the 2nd subform.

That is where the issue is.  I can't get it to do it.  When you doubleclick the "very first record" it opens it just fine.  Any other record, it doesn't.

Not sure where I am wrong.  I am posting that dB here.
TestDB.accdb
Microsoft AccessVB ScriptVisual Basic Classic

Avatar of undefined
Last Comment
Martin Liss
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

from my iPad,

can you post just the code from your double click event?
Avatar of Ernest Grogg
Ernest Grogg

ASKER

Sure...


Forms!frmReportFilter5!frm2.Form.Requery
Avatar of Ernest Grogg
Ernest Grogg

ASKER

This is the code from the Apply Filter

Private Sub cmdApplyFilter_Click()
    Dim strFirstName As String
    Dim strLastName As String
    Dim strFilter As String

' Build First Name criteria string
    If IsNull(Me.txtFirstName.Value) Then
        strFirstName = "Like '*'"
    Else
        Select Case Me.fraFirstName.Value
            Case 1
                strFirstName = "Like '" & Me.txtFirstName.Value & "*'"
            Case 2
                strFirstName = "Like '*" & Me.txtFirstName.Value & "*'"
            Case 3
                strFirstName = "Like '*" & Me.txtFirstName.Value & "'"
            Case 4
                strFirstName = "= '" & Me.txtFirstName.Value & "'"
        End Select
    End If
' Build Last Name criteria string
    If IsNull(Me.txtLastName.Value) Then
        strLastName = "Like '*'"
    Else
        Select Case Me.fraLastName.Value
            Case 1
                strLastName = "Like '" & Me.txtLastName.Value & "*'"
            Case 2
                strLastName = "Like '*" & Me.txtLastName.Value & "*'"
            Case 3
                strLastName = "Like '*" & Me.txtLastName.Value & "'"
            Case 4
                strLastName = "= '" & Me.txtLastName.Value & "'"
        End Select
    End If
' Build filter string
    strFilter = "[FirstName] " & strFirstName & _
                " AND [LastName] " & strLastName
' Apply filter to form
        
        Me.frm.Form.Filter = strFilter
        Me.frm.Form.FilterOn = True
       
      
       
   
End Sub

Open in new window

Ernest, I see Dale is helping so you are in good hands ~ Requery sets the record back to 1 -- use Bookmark to save position and set it back after requery

Dale, Ernest was using a split form and, in another thread, I suggested a regular form with unbound combos in the header and gave him filter code to customize
Avatar of Ernest Grogg
Ernest Grogg

ASKER

Thanks Crystal!
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Ernest Grogg
Ernest Grogg

ASKER

I know...it was just a sample...I didn't set it up but was working with primarily the coding Crystal was working with me on.

I have my DB that is right....but I think I got that to work properly by moving it to the ID in the form's record source.

just testing to make sure at this point.
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo