Results 1 to 3 of 3
  1. #1
    Join Date
    May 2016

    Question Unanswered: [2010] OpenForm not filtering to record from report

    I have a report that I want to be able to edit a record when an Item is clicked.

    Form named: "Consults Form"
    report named: "Consults"

    The Database has a field named SSN = set to text

    On the form there is a textbox named txtSSN

    So on the report it generates I set the SSN "box" when formatting to Hyperlink on so that it has the blue area/link underline. I then went to ON CLICK events..and have tried everything under the sun that matches any example i could find googling/etc. Here are just a few...

    Private Sub SSN_Click()
    DoCmd.OpenForm "Consults Form", acNormal, , "[SSN]= '" & SSN & "'", acFormEdit
    DoCmd.OpenForm "Consults Form", acNormal, , "[SSN]= " & SSN, acFormEdit
    DoCmd.OpenForm "Consults Form", acNormal, , "SSN= '" & SSN & "'", acFormEdit
    DoCmd.OpenForm "Consults Form", acNormal, , "SSN= " & SSN, acFormEdit
    End Sub

    It opens the form, but its blank and does not goto the record. When i goto Design view on the form, the FILTER area shows [SSN] = CORRECT INFO/grabbing the record I need.

    if I manually goto the bottom of the form and type in the search just the data, it pulls it up fine, but not from the FORM when I click. I have done MSGBOX SSN, SSN.text, ME!SSN, etc... and they all pull the same data and show it correctly, but its not passing it to the form to show the record.

    Any assistance would be appreciated. Thank you

  2. #2
    Join Date
    May 2016
    DOH... I figured it out...

    On my form load event i had to modify it..forgot i set it to go to the next new record automatically.... if there is a better solution let me know

    Private Sub Form_Load()
    If Me.Filter = "" Then
    DoCmd.GoToRecord , , acNewRec
    End If
    End Sub

  3. #3
    Join Date
    May 2016
    Provided Answers: 1
    I had to do a similar thing with one of my reports and after lots and lots of serching i used this macro. Not sure what it would be in vba code but this is the macro i have set up

    If IsNull([ID)] Then
    End If
    If Not IsNull([ID])
      OpenForm FormName
    View Form
    Filter Name BLANK
    Where Condition = ="[ID]=" & [ID]
    Data Mode BLANK
    Window Mode Normal
    Go to Next
    Macro Name
    Control Name

    I put that on each column so no matter where in the row they click it will bring them to the edit form

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts