Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2002

    Question Unanswered: Moving to a specific record

    Hello. I have a query subform that shows results from information entered in some text boxes on the main form. I would like to find a way to double-click on the claim number field in the query subform and it moves the record to the claim number specified on the subform. For example, I have a form called "Manual Claims System - MR Canada." On that form, it has a textbox called ClaimNumber. I also have another form called "Search Form." On the "Search Form", I have a subform called "Search Query Subform." On the subform, there are the query results. One of the query result fields is ClaimNumber. When I double click on that field, I would like the textbox on the "Manual Claiims System - MR Canada" to be in synch with the result that was double clicked. Please advise.

  2. #2
    Join Date
    Nov 2001
    Possibly what you need is a way to return a value from a form.
    Here is the trick:

    Suppose, on your search form (frmSearch) you have cmdGo, cmdCancel and txtSearchResult.
    Here is the code in frmSearch:

    Private Sub cmdCancel_Click()
    End Sub

    Private Sub cmdGo_Click()
    Me.Visible = False
    End Sub

    Here is the code in the main form (frmMain)


    dim strRetValue as String


    docmd.openform "frmSearch", , , , , acModal
    If IsLoaded("frmSearch") Then
    msgbox "Returned: " & Forms!frmSearch.txtSearchResult
    strRetValue = Forms!frmSearch.txtSearchResult
    DoCmd.Close acForm, "frmSearch"


    Here is a code for a code module:
    Function IsLoaded(ByVal strFormName As String) As Boolean
    ' Returns True if the specified form is open in Form view or Datasheet view.

    Const conObjStateClosed = 0
    Const conDesignView = 0

    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
    If Forms(strFormName).CurrentView <> conDesignView Then
    IsLoaded = True
    End If
    End If

    End Function

    I hope I didn't make any typos in the code I post here.
    Anyway, try it.

Posting Permissions

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